chatHistory
that backs chat memory classes like BufferMemory
for a Redis instance.
Setup
You will need to install node-redis in your project:npm
Usage
Each chat history session stored in Redis must have a unique id. You can provide an optionalsessionTTL
to make sessions expire after a give number of seconds.
The config
parameter is passed directly into the createClient
method of node-redis, and takes all the same arguments.
Advanced Usage
You can also directly pass in a previously created node-redis client instance:Redis Sentinel Support
You can enable a Redis Sentinel backed cache using ioredis This will require the installation of ioredis in your project.npm