Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hiredis with redis-session-store #108

Open
codematix opened this issue Aug 7, 2018 · 3 comments
Open

Hiredis with redis-session-store #108

codematix opened this issue Aug 7, 2018 · 3 comments

Comments

@codematix
Copy link

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

@leastbad
Copy link
Collaborator

leastbad commented Sep 18, 2022

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.

@santiagodoldan
Copy link

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

@santiagodoldan
Copy link

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

gem 'hiredis-client'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants