https://github.com/creationix/nstore-session
This is a connect session store using nStore
https://github.com/creationix/nstore-session
Last synced: about 1 year ago
JSON representation
This is a connect session store using nStore
- Host: GitHub
- URL: https://github.com/creationix/nstore-session
- Owner: creationix
- Created: 2010-07-13T18:38:01.000Z (almost 16 years ago)
- Default Branch: master
- Last Pushed: 2012-02-27T14:30:05.000Z (over 14 years ago)
- Last Synced: 2025-03-24T04:14:37.933Z (about 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 104 KB
- Stars: 50
- Watchers: 2
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.markdown
Awesome Lists containing this project
README
# nStore Session Store for Connect
This is a simple session store for [Connect][] that uses [nStore][] for persisting session data. It implements the full Session Store interface and has built-in pruning of stale sessions on every nStore database compaction.
## Usage
Create a connect app, and use this as the session store.
var Connect = require('connect'),
nStoreSession = require('./lib/nstore-session');
// Set up a base app with some global filters
var App = module.exports = Connect.createServer(
Connect.logger(),
Connect.cookieDecoder(),
Connect.session({store: new nStoreSession()}),
Connect.router(function (app) {
app.get("/", function (req, res) {
res.simpleBody(200, req.session);
});
})
);
## Options
You can pass options into the call to `new nStoreSession({})`.
- **maxAge** - When the nStore database is compacted, any sessions last accessed more than `maxAge` ago (in ms) will be pruned. Defaults to 1 hour.
- **dbFile** - Where to store the nStore database, defaults to "sessions.db" in the current directory.
[Connect]: http://extjs.github.com/Connect/
[nStore]: http://github.com/creationix/nstore