Skip to content

Messinger/redis-activesupport-with-cas

Repository files navigation

Redis store with CAS for ActiveSupport

redis-activesupport-with-cas provides a cache for ActiveSupport including 'Compare and Swap' methods.

It is based on redis-store and may used with Identity Cache.

Installation

# Gemfile
gem 'redis-activesupport-with-cas'

Usage

ActiveSupport::Cache.lookup_store :redis_store_with_cas # { ... optional configuration ... }

Usage with IdentityCache

Inside your environments configuration add following line:

config.cache_store = :redis_store_with_cas, { :host => 'localhost', :port => 6379, :db => 0, :namespace => "data_cache", :expires_in => 15.minutes, :race_condition_ttl => 1}
IdentityCache.cache_backend = ActiveSupport::Cache.lookup_store(*Rails.configuration.cache_store)

Running tests

gem install bundler
git clone https://git.alwin-it.de/ruby-redis/redis-activesupport-with-cas.git
cd redis-activesupport-with-cas
bundle install
bundle exec rake

Copyright

2017 Rajko Albrecht, released under the MIT license

About

Add CAS methods to redis-store based activesupport-cache

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages