session icon indicating copy to clipboard operation
session copied to clipboard

Compatibility with koa-redis?

Open knpwrs opened this issue 5 years ago • 1 comments

I've gotten myself confused about how to properly manage sessions with redis and koa:

  • There are two projects, koa-session and koa-generic-session. They are both recently updated and neither mentions the other.
  • The README for koa-session does not recommend any external session stores, the README for koa-generic-session mentions koa-redis.
  • When attempting to use @types/koa-generic-session, @types/koa-session, and @types/koa-redis it appears that koa-redis IS compatible with koa-session, but IS NOT compatible with koa-generic-session.
  • The README for koa-session specifies that a store should have get(key, maxAge, { rolling, ctx }), but koa-redis has get(key) (no second or third parameters).
  • The README for koa-session specifies that a store should have set(key, sess, maxAge, { rolling, changed, ctx }), koa-redis has set(sid, sess, ttl) (no fourth parameter).
  • The README for koa-session specifies that a store should have destroy(key, {ctx}). koa-redis has destroy(sid) (no second parameter).
  • Upon initial trial, it appears (on the surface) that koa-session works with koa-redis, though I fear this may be a coincidence.

Are the typings incorrect? Is koa-redis only meant to be used with koa-generic-session? Or can koa-redis be used with koa-session? What is the recommended method for managing sessions with koa and redis?

knpwrs avatar Nov 28 '20 20:11 knpwrs

It seems like a number of things are in limbo right now:

  • https://github.com/koajs/koa-redis/issues/35
  • https://github.com/koajs/koa-redis/issues/35#issuecomment-571536410
  • https://github.com/koajs/koa-redis/pull/56

knpwrs avatar Nov 28 '20 21:11 knpwrs