Watch 1 Star 0

码云极速下载 / redis-session

Sign up for free
Explore and code with more than 2 million developers,Free private repositories !:)
Sign up
此仓库是为了提升国内下载速度的镜像仓库,每日同步一次。 原始仓库: https://github.com/geemo/redis-session
Nothing here. spread retract

Clone or download
Loading...
README.md

redis-session

Installation

$ git clone https://github.com/geemo/redis-session.git

Usage

const app = express();
const session = require('redis-session');

app.use(session({
	url: 'redis://127.0.0.1:6379/0',
	sidKey: 'redis.sid',
	cookie: {
		maxAge: 24 * 60 * 60 * 1000	//ms
	},
	ttl: 24 * 60 * 60,	//sec
	resave: true,
	saveUninit: false
}));

session(options)

Create a session middleware with the given options.

url

Redis server url. The default value is "redis://127.0.0.1:6379/0".

sidKey

Session ID cookie name. The default value is "redis.sid".

cookie

Settings for the session ID cookie.

The default value is { path: '/', httpOnly: true, maxAge: 604800000 \*7 days*\}.

ttl

Redis session TTL (expiration) in seconds. The default value is one day.

resave

Forces the session to be saved back to the session store. The default value is true.

saveUninit

Forces a session that is "uninitialized" to be saved to the store. The default value is true.

Comments ( 0 )

You need to Sign in for post a comment

Help Search