jaysylvester / citizen

Node.js MVC web application framework. Includes routing, serving, caching, session management, and other helpful tools.
MIT License
100 stars 7 forks source link

External session storage #120

Open jaysylvester opened 7 months ago

jaysylvester commented 7 months ago

Provide an option for storing user sessions in an external location (a database, for example). This will allow the app server to become stateless and enable its use in clustered environments.

Add appropriate methods to the following modules to enable storage and retrieval:

lib/session.js lib/hooks/session.js app/hooks/session.js

The developer will create custom store() and retrieve() methods within app/hooks/session.js that return a session ID and session object, respectively.

Add settings to init/config.js to enable external session storage:

// defaults
sessions: {
  enabled: false,
  lifespan: 20,
  storage: 'internal'
}

// external storage
sessions: {
  enabled: true,
  lifespan: 15,
  storage: 'external'
}