ChiChou / koa-sqlite3-session

sqlite3 adaption for koa-generic-session
http://chichou.github.io/koa-sqlite3-session
MIT License
9 stars 1 forks source link

ttl should be in ms #1

Closed natesilva closed 7 years ago

natesilva commented 7 years ago

The documentation for koa-generic-session shows milliseconds (ms) are supposed to be used, instead of seconds. For example, this should have a TTL of 1 day, but SQLite3Store gives it a TTL of 1,000 days:

app.use(session({
    store: new SQLite3Store('filename.db'),
    ttl: 86400000         // ms
});

It works great if you pass in seconds:

app.use(session({
    store: new SQLite3Store('filename.db'),
    ttl: 86400
});

One nice thing about koa-generic-session is that you can swap out one session provider for another. For example you could use SQLite for sessions when doing local development, and Redis on a production server. But with this difference you can’t share the same config between koa-redis and koa-sqlite3-session.

ChiChou commented 7 years ago

Thanks!