Botmaster Session Ware Redis Store
This is the Redis store adapter for the botmaster-session-ware middleware.
Install
yarn add botmaster-session-ware-redis-store
or with npm
npm install --save botmaster-session-ware-redis-store
Note
This package is an adapter for botmaster-session-ware: https://github.com/botmasterai/botmaster-session-ware
API
RedisStore
Using this adapter along with the botmaster-session-ware middleware will store sessions in redis rather than use the default in memory store which should not be used in production
Parameters
redisSettings
settings
object just a valid ioredis settings object as per: https://github.com/luin/ioredis which is used under the hood. By default, will connect to 127.0.0.1:6379 *
Examples
const Botmaster = ;// Using this socket.io bot class for the sake of the exampleconst SocketioBot = ;const SessionWare = ;const SessionWareRedisStore = ; const botmaster = ;botmaster; // declaring middleware botmaster // This will make our context persist throughout different messages from the// same userconst sessionWare = adapter: ;botmaster;
get
Get or create a session with the id.
Parameters
id
String a unique id for the session
Returns Promise evaluates to an object that is the session
set
Update a session in the storage.
Parameters
Returns Promise resolves when the session has been saved