GithubHelp home page GithubHelp logo

cache_migration's Introduction

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.

cache_migration's People

Contributors

jbaudanza avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.