Module: BackgroundCache::Memcache

Defined in:
lib/background_cache/mem_cache.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



4
5
6
# File 'lib/background_cache/mem_cache.rb', line 4

def self.included(base)
  base.alias_method_chain :get, :background_cache
end

Instance Method Details

#get_with_background_cache(key, raw = false) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/background_cache/mem_cache.rb', line 8

def get_with_background_cache(key, raw=false)
  match = (
    BackgroundCache.active? &&
    BackgroundCache.match?(key)
  )
  if match
    nil
  else
    get_without_background_cache(key, raw)
  end
end