mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-26 08:33:49 +00:00
Add async methods to InMemoryCache (#17425)
Add async methods to InMemoryCache
This commit is contained in:
parent
93472ee9e6
commit
fb7552bfcf
@ -192,6 +192,20 @@ class InMemoryCache(BaseCache):
|
||||
"""Clear cache."""
|
||||
self._cache = {}
|
||||
|
||||
async def alookup(self, prompt: str, llm_string: str) -> Optional[RETURN_VAL_TYPE]:
|
||||
"""Look up based on prompt and llm_string."""
|
||||
return self.lookup(prompt, llm_string)
|
||||
|
||||
async def aupdate(
|
||||
self, prompt: str, llm_string: str, return_val: RETURN_VAL_TYPE
|
||||
) -> None:
|
||||
"""Update cache based on prompt and llm_string."""
|
||||
self.update(prompt, llm_string, return_val)
|
||||
|
||||
async def aclear(self, **kwargs: Any) -> None:
|
||||
"""Clear cache."""
|
||||
self.clear()
|
||||
|
||||
|
||||
Base = declarative_base()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user