i'm using redis as my session store for a node.js + express app...will it automatically delete old sessions after they expire?
...or do I need to do some cleanup on the server side? (so the db doesn't grow too large)
var RedisStore = require('connect-redis')(express)
app.use(express.session({
store: new RedisStore({
host: cfg.redis.host,
db: cfg.redis.db
}),
secret: 'foobar'
}));
It's working as expected. If I do a browser-only session (expires cookie when user-agent closes) then it lives in redis for 24 hours (I did not set a ttl option in connect-redis).
If I set a cookie to expire in 2 weeks, it lives in redis for 14 days.
You can check with these commands:
start redis-cli
> keys *
> ttl <key>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With