langchain_community.cache.InMemoryCache¶

class langchain_community.cache.InMemoryCache[source]¶

Cache that stores things in memory.

Initialize with empty cache.

Methods

__init__()

Initialize with empty cache.

clear(**kwargs)

Clear cache.

lookup(prompt, llm_string)

Look up based on prompt and llm_string.

update(prompt, llm_string, return_val)

Update cache based on prompt and llm_string.

__init__() None[source]¶

Initialize with empty cache.

clear(**kwargs: Any) None[source]¶

Clear cache.

lookup(prompt: str, llm_string: str) Optional[Sequence[Generation]][source]¶

Look up based on prompt and llm_string.

update(prompt: str, llm_string: str, return_val: Sequence[Generation]) None[source]¶

Update cache based on prompt and llm_string.

Examples using InMemoryCache¶