connect-ironcache

IronCache session store for Connect

npm install connect-ironcache
1 downloads in the last day
17 downloads in the last week
53 downloads in the last month

connect-ironcache

IronCache session store, using node-ironio for communication with cache server.

Installation

via npm:

  $ npm install connect-ironcache

Example

  /**
  * Module dependencies.
  */

  var express = require('express');

  // pass the express to the connect IronCache module
  // allowing it to inherit from express.session.Store
  var IronCacheStore = require('connect-ironcache')(express);

  var app = express.createServer();

  app.use(express.favicon());

  // request logging
  app.use(express.logger());

  // required to parse the session cookie
  app.use(express.cookieParser());

  // Populates:
  // - req.session
  // - req.sessionStore
  // - req.sessionID (or req.session.id)

  app.use(express.session({
      secret: 'PumpThatIronLikeThereIsNoTomorrow',
      store: new IronCacheStore({oauthToken:"<INSERT IRONCACHE TOKEN>", projectID:"<INSERT IRONCACHE PROJECT ID>", cacheID:"<INSERT IRONCACHE CACHE>"})
  }));

  app.get('/', function(req, res){
    if (req.session.views) {
      ++req.session.views;
    } else {
      req.session.views = 1;
    }
    res.send('Viewed <strong>' + req.session.views + '</strong> times.');
  });

  app.listen(3000);
  console.log('Express app started on port 3000');
npm loves you