sorentwo / readthis

:newspaper: Pooled active support compliant caching with redis
MIT License
506 stars 40 forks source link

Session store #33

Closed espen closed 8 years ago

espen commented 8 years ago

Is there any advantage for this project to have its own ActionDispatch session store over the ActionDispatch::Session::CacheStore?

If not, perhaps it should be mentioned in readme.md that it's possible to use this gem for storing sessions?

sorentwo commented 8 years ago

@espen Nope, there wouldn't be any advantage at all. The CacheStore only uses read, write, and delete, so there aren't any more advanced or optimized calls that would be made. I'd happily accept a PR that mentioned using it as a session store.

espen commented 8 years ago

For reference: one difference is that with most other cache stores you can add a prefix to the stored key. With CacheStore you can't add a prefix and it is namespaced with _session_id in addition to the namespace defined in Readthis: https://github.com/rails/rails/blob/930110b0452bd33e0ee54e9ec6d68e904ba7a0ad/actionpack/lib/action_dispatch/middleware/session/cache_store.rb#L44

sorentwo commented 8 years ago

Can you give me an example of the cache keys you would like to see? The Rails CacheStore has a very small API and wouldn't take much, but I'd like to know exactly what you're aiming to achieve.

espen commented 8 years ago

I think the Rails Session CacheStore should handle this. I started a discussion here: https://groups.google.com/forum/#!topic/rubyonrails-core/kM7Bcrts3ME