class Sass::CacheStores::Chain

  • When one cache has a hit, the value is ‘#store`d in all earlier caches.
    * `#retrieve`s are passed to each cache until one has a hit.
    * All `#store`s are passed to all caches.
    Specifically:
    A meta-cache that chains multiple caches together.

def initialize(*caches)

Parameters:
  • caches (Array) -- The caches to chain.
def initialize(*caches)
  @caches = caches
end

def retrieve(key, sha)

Other tags:
    See: Base#retrieve -
def retrieve(key, sha)
  @caches.each_with_index do |c, i|
    obj = c.retrieve(key, sha)
    next unless obj
    @caches[0...i].each {|prev| prev.store(key, sha, obj)}
    return obj
  end
  nil
end

def store(key, sha, obj)

Other tags:
    See: Base#store -
def store(key, sha, obj)
  @caches.each {|c| c.store(key, sha, obj)}
end