class LHC::Caching::MultilevelCache
def fetch(key)
def fetch(key) central_response = @central[:read].fetch(key) if @central && @central[:read].present? if central_response puts %Q{[LHC] served from central cache: "#{key}"} return central_response end local_response = @local.fetch(key) if @local if local_response puts %Q{[LHC] served from local cache: "#{key}"} return local_response end end
def initialize(central: nil, local: nil)
def initialize(central: nil, local: nil) @central = central @local = local end
def write(key, content, options)
def write(key, content, options) @central[:write].write(key, content, options) if @central && @central[:write].present? @local.write(key, content, options) if @local.present? end