Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

tpdn/double_write_cache_stores

Repository files navigation

DoubleWriteCacheStores

pre-warning(double write to cach store and other cache store) cache store wrapper. will switch cache store.

Convertible interface, get/set by cache store

  • Padrino::Cache(moneta)
  • ActiveSupport::Cache::DalliStore(Dalli)
  • Padrino::Cache::Store::Memcache

Support backend cache store

  • ActiveSupport::Cache::DalliStore(Dalli)
  • Padrino::Cache::Store::Memcache

Installation

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

Usage

Padrino

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)

Rails4

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)

in application

Rails.cache.fetch("key") do
 "value"
end

Contributing

  1. Fork it ( http://github.com/hirocaster/double_write_cache_stores/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

About

Double write cache stores wrapper.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 100.0%

AltStyle によって変換されたページ (->オリジナル) /