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

add redis as centralised cache store #81

Closed
tarrygo opened this issue May 5, 2015 · 1 comment
Closed

add redis as centralised cache store #81

tarrygo opened this issue May 5, 2015 · 1 comment

Comments

@tarrygo
Copy link

tarrygo commented May 5, 2015

I am planning to use makara gem for rails application. I want to use redis as my cache store that will be shared between multiple server running the application.

the commands supported by makara cache are read and write. How can we add support for redis.

@mnelson
Copy link
Contributor

mnelson commented Jun 16, 2015

You would create a redis adapter and set it up in an initializer.

#config/initializers/makara.rb
class RedisAdapter
  def read(key)
    $redis.get(key)
  end
  def write(key, value, ttl)
    $redis.setex(key, ttl, value)
  end
end

::Makara::Cache.store = RedisAdapter.new

@mnelson mnelson closed this as completed Jun 16, 2015
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

2 participants