dox-foundation-demo node_modules/express/node_modules/connect/lib/middleware/session/store.js

EventEmitter

declaration
EventEmitter

    Description

    Module dependencies.

    Source

    var EventEmitter = require('events').EventEmitter
      , Session = require('./session')
      , Cookie = require('./cookie');

    __proto__

    property
    Store.prototype.__proto__

      Description

      Inherit from EventEmitter.prototype.

      Source

      Store.prototype.__proto__ = EventEmitter.prototype;

      regenerate

      method
      Store.prototype.regenerate()
      • @param: {IncomingRequest}req
      • @return: {Function}fn

      Description

      Re-generate the given requests's session.

      Source

      Store.prototype.regenerate = function(req, fn){
        var self = this;
        this.destroy(req.sessionID, function(err){
          self.generate(req);
          fn(err);
        });
      };

      load

      method
      Store.prototype.load()
      • @param: {String}sid
      • @param: {Function}fn

      Description

      Load a Session instance via the given sid
      and invoke the callback fn(err, sess).

      Source

      Store.prototype.load = function(sid, fn){
        var self = this;
        this.get(sid, function(err, sess){
          if (err) return fn(err);
          if (!sess) return fn();
          var req = { sessionID: sid, sessionStore: self };
          sess = self.createSession(req, sess);
          fn(null, sess);
        });
      };