redis-session-store
redis-session-store copied to clipboard
Hiredis with redis-session-store
How can I use redis-session-store with hiredis? Are there any examples that I can use to understand?
Assuming that you have the hiredis gem in your Gemfile, just specify it as the driver in your redis options hash.
I pulled this straight from one of my working applications:
config.session_store :redis_session_store, {
serializer: :json,
on_redis_down: ->(*a) { logger.error("Redis down! #{a.inspect}") },
redis: {
driver: :hiredis,
expire_after: 2.weeks,
key_prefix: "myapp:session:",
url: ENV.fetch("REDIS_URL") { "redis://localhost:6379/0" }
}
}
Sorry if you died before getting this sorted out.
@leastbad I get ArgumentError: Unknown driver :hiredis, expected one of: '[:ruby]', is there something else other than adding hiredis gem?
Ok, I figured it out, adding this to your Gemfile fixes above issue
gem 'hiredis-client'