thinkjs / think-session-redis

Use Redis store session for ThinkJS 3.x

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

think-session-redis

Use Redis to store session for ThinkJS

Build Status Coverage Status npm

Install

npm install think-session-redis

How to use

config file src/config/adapter.js, add options:

const redisSession = require('think-session-redis');
exports.session = {
  type: 'redis',
  common: {
    cookie: {
      name: 'thinkjs',
      //maxAge: '',
      //expires: '',
      path: '/',  //a string indicating the path of the cookie
      //domain: '',
      //secure: false,
      //keys: [],
      httpOnly: true,
      sameSite: false,
      signed: false,
      overwrite: false
    }
  },
  redis: {
    handle: redisSession,
    maxAge: 3600 * 1000, //session timeout, if not set, session will be persistent.
    autoUpdate: false, //update expired time when get session, default is false
  }
}

About

Use Redis store session for ThinkJS 3.x

License:MIT License


Languages

Language:JavaScript 100.0%