Retrieves data from the cache. It constructs a cache key from the given
prompt
and llmKey
, and retrieves the corresponding value from the
cache files.
The prompt used to construct the cache key.
The LLM key used to construct the cache key.
An array of Generations if found, null otherwise.
Updates the cache with new data. It constructs a cache key from the
given prompt
and llmKey
, and stores the value
in a specific
file in the cache directory.
The prompt used to construct the cache key.
The LLM key used to construct the cache key.
The value to be stored in the cache.
Static
createCreate a new cache backed by the local filesystem. It ensures that the cache directory exists before returning.
Optional
cacheDir: string
A cache that uses the local filesystem as the backing store. This is useful for local development and testing. But it is not recommended for production use.