[![NPM Version][npm-image]][npm-url] [![NPM Downloads][downloads-image]][downloads-url]
$ npm install sessioncache-express
Add to your application's package.json's dependency section
"sessioncache-express" : "1.0.0"
This is an implementation of a data store for the express-session module using the Data Cache service available on IBM Bluemix.
If you are not running your application on Bluemix, a very simple in-memory session table will be used. There are several options available to customize the behavior of both the session store and the backing Data Cache service instance.
Implementation is very straightforward. The necessary requires in your express application:
var session = ;var SessionCacheStore = session;
The configuration of the express-session middleware itself:
var options = mapname: 'mydatacachemap'eviction: 'LAT'ttl: 300fallbackMemoryStore: false;app;
Options has four recognized properties, but defaults are provided for all properties.
mapnameDefines the map to be used on the Data Cache grid so you can control where the session keys/values are stored in the service.
evictionDefines how sessions are evicted should the cache run out of space. Eviction by last access time (LAT) is the default, but LUT (last update time) is also another option.
ttlDefines how long an entry should remain in the backing Data Cache instance. This is effectively your session expiration duration. If left blank, no TTL will be used and sessions will only be purged as space is needed in the cache.
fallbackMemoryStoreWhen set to true, will fallback to using express-session's default in-memory implementation if the application is not running in the Bluemix environment. This is useful for removing the specific sessioncache-express functionality for debugging, or just to get a new app up and running.
Please report issues to firstname.lastname@example.org