Quantcast
Channel: Active questions tagged redis+ruby-on-rails - Stack Overflow
Viewing all articles
Browse latest Browse all 873

How do I make custom Redis keys for redis-rails Sessions?

$
0
0

I'm trying to set up redis-rails sessions with some unique behavior. I need to be able to allow multiple sessions by the same user, and also get all of the sessions owned by a particular user.

I don't want to have to search redis by value since that would result in poor performance. So I was thinking I could prepend the session's key with the user's id, and then do a get query with a wildcard.

It looks like I can add a namespace option to session_store, but that's just for namespacing to keep multiple apps from colliding, and won't generate the prefix dynamically.

I've tried monkeypatching Rack's generate_sid method, but I don't have access to the user resource and its id at that level, so I can change the way it's generated, but it can only be a different random number.


Viewing all articles
Browse latest Browse all 873

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>