0.9.1 • Published 3 years ago
simples-redis-store v0.9.1
simples-redis-store 0.9.1
simples-redis-store is a store for simples that is using redis database,
it is designed to work with simples starting version 0.9.0.
Install
npm i simples-redis-storeUsage
Basic usage consists in creating a new redis store and providing it to the server configuration.
const simples = require('simples');
const RedisStore = require('simples-redis-store');
const server = simples();
const store = new RedisStore();
server.session({
enabled: true,
store
});In case a client to the database is already created it can be used as a parameter to the redis store constructor like in the following example:
const redis = require('redis');
const simples = require('simples');
const RedisStore = require('simples-redis-store');
const client = redis.createClient(/* Redis client configuration */);
const server = simples();
const store = new RedisStore(client);
server.session({
enabled: true,
store
});The redis client is always available as a property.
store.client; // Redis client