session-memory-store
Memory store for session that can auto check expired.
Last updated a year ago by xiaoyuze88 .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install session-memory-store 
SYNC missed versions from official npm registry.

session-memory-store

A session store implementation for Express using node-cache.

Because the default store for express-session -- memory-cache will lead to a memory leak due to it havn't a suitable way to make them expire.

And this is why I make this project, for those who want to use in-memory session, also want them to auto expire.

WANING

The session is still storing in memory, you can't share the session with others process or other service.

It's highly not recommend to use it in production!

USAGE

var express = require('express'),
  session = require('express-session'),
  cookieParser = require('cookie-parser');

// for express 4.0+
var MemoryStore = require('session-memory-store')(session);

// for express 4.0-
// var MemoryStore = require('session-memory-store')(express);

var app = module.exports = express();

app.use(cookieParser());

app.use(session({
  name: 'JSESSION',
  secret: 'my secret',
  store: new MemoryStore(options)
}));

OPTIONS

options.expires

(Number) Defined how long each session will be expired. In second. Default: half a day, 60 * 60 * 12

options.checkperiod

(Number) Defined how long MemoryStore will check for expired. In second. Default: 10 minutes, 10 * 60

Current Tags

  • 1.0.0                                ...           latest (a year ago)

5 Versions

  • 1.0.0                                ...           a year ago
  • 0.2.2                                ...           4 years ago
  • 0.2.1                                ...           4 years ago
  • 0.2.0                                ...           4 years ago
  • 0.1.0                                ...           4 years ago
Maintainers (1)
Downloads
Today 4
This Week 243
This Month 651
Last Day 70
Last Week 343
Last Month 1,394
Dependencies (1)
Dev Dependencies (0)
None

Copyright 2014 - 2016 © taobao.org |