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
7
# File 'lib/background_cache/mem_cache.rb', line 4

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

Instance Method Details

#get_multi_with_background_cache(key, options = {}) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
# File 'lib/background_cache/mem_cache.rb', line 21

def get_multi_with_background_cache(key, options={})
  match = (
    BackgroundCache.active? &&
    BackgroundCache.match?(key)
  )
  if match
    nil
  else
    get_multi_without_background_cache(key, options)
  end
end

#get_with_background_cache(key, raw = false) ⇒ Object



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

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