roidrage / redis-session-store

A simple session store for Rails based on Redis.
http://github.com/roidrage/redis-session-store
MIT License
366 stars 147 forks source link

Reduce exists command by loading from private_id first #148

Open hogelog opened 1 year ago

hogelog commented 1 year ago

The current redis-session-store has been implemented to throw the exists command to redis twice. https://github.com/roidrage/redis-session-store/blob/21c576d5460f38ee781037114ec22f354c453828/lib/redis-session-store.rb#L68 https://github.com/roidrage/redis-session-store/blob/21c576d5460f38ee781037114ec22f354c453828/lib/redis-session-store.rb#L124

With this PR implementation, a session that has not been migrated to private_id will throw get commands to private_id and public_id twice. But migrated session will only get once, which I think is more efficient.