pre-warning(double write to cach store and other cache store) cache store wrapper. will switch cache store.
- Padrino::Cache(moneta)
- ActiveSupport::Cache::DalliStore(Dalli)
- Padrino::Cache::Store::Memcache
- ActiveSupport::Cache::DalliStore(Dalli)
- Padrino::Cache::Store::Memcache
Add this line to your application's Gemfile:
gem 'double_write_cache_stores'
And then execute:
$ bundle
Or install it yourself as:
$ gem install double_write_cache_stores
config/apps.rb
read_and_write_cache_store = ActiveSupport::Cache.lookup_store :dalli_store, 'localhost:11211'
write_only_cache_store = ActiveSupport::Cache.lookup_store :dalli_store, 'localhost:21211'
set :cache, DoubleWriteCacheStores::Client.new(read_and_write_cache_store, write_only_cache_store)
config/application.rb
read_and_write_cache_store = ActiveSupport::Cache.lookup_store :mem_cache_store, 'localhost:11211'
write_only_cache_store = ActiveSupport::Cache.lookup_store :mem_cache_store, 'localhost:21211'
config.cache_store = DoubleWriteCacheStores::Client.new(read_and_write_cache_store, write_only_cache_store)
Rails.cache.fetch("key") do
"value"
end
- Fork it ( http://github.com/hirocaster/double_write_cache_stores/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request