Skip to content

Express session expiration (session timeout) #173

@catamphetamine

Description

@catamphetamine

Hello.
I've modified Node.js' Express.js MemoryStore store to support session expiration (session timeout).
Here is the link to the forked class:
https://github.com/kuchumovn/session/blob/master/session/memory.js
Everything there seems self explanatory.
If you find this code useful I can make a pull request.
If not then here are some keywords for google.

Usage for regular users who came here from google or stackoverflow:

1 . Download the memory.js file from the link above and add it to your project
2 . Modify the file in the beginning - replace this:

var Store = require('./store')

with this:

var Store = require('express-session').Store

3 . In your express initialization code:

var BetterMemoryStore = require(__dirname + '/memory')
var store = new BetterMemoryStore({ expires: 60 * 60 * 1000, debug: true })
require('express-session')({ ..., store: store, ... })

4 . You should turn off the debug parameter in the code above for production. The expires parameter is in milliseconds

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions