0.0
No commit activity in last 3 years
No release in over 3 years
ActiveSupport::Cache::Store implementation to help migrating caches
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

 Project Readme

cache_migration

CacheMigration is an ActiveSupport::Cache::Store implementation to aid in the transition between a hot cache server and a new cold cache server.

If you don't have a process for warming a new cache server, this process can be difficult. Switching your application "cold-turkey" to a new cache server can have a detrimental effect on performance and usability.

The CacheMigration gem will allow you to keep both the old and new cache servers online for a transition period, while the new cache server gradually becomes warmed through normal usage.

During the transition period, all writes will be sent to both cache servers.

When a read occurs, CacheMigration will first try to read from the new server. If there is a miss, the gem will fall back to the old server. If there is a hit on the new server, the data will be written back to the new server, thus warming it.

After enough time, when the new cache server is sufficiently warm, you can remove this gem and move back to using your normal cache interface. The old servers can be safely taken offline.

Gemfile

gem 'cache_migration'

production.rb

require 'active_support/cache/dalli_store'

old_cache = ActiveSupport::Cache::DalliStore.new(
    ENV["OLD_MEMCACHE_SERVERS"].split(","),
    :username => ENV['OLD_MEMCACHE_USERNAME'],
    :password => ENV['OLD_MEMCACHE_PASSWORD'])

new_cache = ActiveSupport::Cache::DalliStore.new(
    ENV["NEW_MEMCACHE_SERVERS"].split(","),
    :username => ENV['NEW_MEMCACHE_USERNAME'],
    :password => ENV['NEW_MEMCACHE_PASSWORD'])

config.cache_store = CacheMigration.new(new_cache, old_cache)

This gem was designed to work with DalliStore, but it should work with any API compliant cache store.