Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thinkjs/think-session-redis
Use Redis store session for ThinkJS 3.x
https://github.com/thinkjs/think-session-redis
thinkjs thinkjs3
Last synced: about 1 month ago
JSON representation
Use Redis store session for ThinkJS 3.x
- Host: GitHub
- URL: https://github.com/thinkjs/think-session-redis
- Owner: thinkjs
- License: mit
- Created: 2016-06-17T08:59:21.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2021-10-14T04:02:42.000Z (about 3 years ago)
- Last Synced: 2024-10-08T18:28:33.406Z (2 months ago)
- Topics: thinkjs, thinkjs3
- Language: JavaScript
- Homepage:
- Size: 12.7 KB
- Stars: 2
- Watchers: 5
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- think-awesome - think-session-redis
README
# think-session-redis
Use Redis to store session for ThinkJS[![Build Status](https://img.shields.io/travis/thinkjs/think-session-redis/master.svg?style=flat-square)](https://travis-ci.org/thinkjs/think-session-redis)
[![Coverage Status](https://img.shields.io/coveralls/thinkjs/think-session-redis/master.svg?style=flat-square)](https://coveralls.io/github/thinkjs/think-session-redis?branch=master)
[![npm](https://img.shields.io/npm/v/think-session-redis.svg?colorB=brightgreen&style=flat-square)](https://www.npmjs.com/package/think-session-redis)## Install
```
npm install think-session-redis
```## How to use
config file `src/config/adapter.js`, add options:
```js
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
}
}
```