redis-session-store icon indicating copy to clipboard operation
redis-session-store copied to clipboard

Hiredis with redis-session-store

Open codematix opened this issue 7 years ago • 3 comments

How can I use redis-session-store with hiredis? Are there any examples that I can use to understand?

codematix avatar Aug 07 '18 15:08 codematix

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 avatar Sep 18 '22 06:09 leastbad

@leastbad I get ArgumentError: Unknown driver :hiredis, expected one of: '[:ruby]', is there something else other than adding hiredis gem?

santiagodoldan avatar Apr 21 '23 17:04 santiagodoldan

Ok, I figured it out, adding this to your Gemfile fixes above issue

gem 'hiredis-client'

santiagodoldan avatar Apr 21 '23 17:04 santiagodoldan