smart-session
An ExpressJS Middleware which manages your Session Hassle with a horizontal scaling factor. Node-Redis uses queue to execute your query so I decided to create multiple clients to redis in case you are developing a Super high End Web Product.
How to use
var express = var session = ;var app = ;var config = "redis": "ip": "0.0.0.0" "session": "cookieName": "someCoolSessionCookieName" // doesn't matter if you don't give one app;app
Well that was just an old fashioned way, isn't it? Lets be smart!
var express = var session = ;var app = ;var config = "redis": "ip": "0.0.0.0" "session": "cookieName": "somethingWhichSoundsLikeMIAgentName" // if not then I have a default one app;app
Methods
request.session.add(key, value)
Where Key can be any text value and Value, Well value can be anything, JSON object, buffer, I don't know whatever you wanna save.
request.session.update()
Well, when you are done messing up with the session variable, just hit this function and it will save all your mess in a gentle way
request.session.remove(key)
C'mon, the name reads the whole, remove a session variable
request.session.destroy()
Satan = Initialise->Satan()
Satan->KillTheSession()
Scaling
var config = "redis": // Redis details clientLimit: someIntegerValueThatDefinesYourScaling //Wooh! That's too long
ToDos
- Redis authentication(a bit lazy will do in few weeks)
- More Fun!