Module: Gitlab::ProcessMemoryCache::Helper

Included in:
Ci::InstanceVariable
Defined in:
lib/gitlab/process_memory_cache/helper.rb

Instance Method Summary collapse

Instance Method Details

#fetch_memory_cache(key, &payload) ⇒ Object


6
7
8
9
10
11
12
13
14
# File 'lib/gitlab/process_memory_cache/helper.rb', line 6

def fetch_memory_cache(key, &payload)
  cache = cache_backend.read(key)

  if cache && !stale_cache?(key, cache)
    cache[:data]
  else
    store_cache(key, &payload)
  end
end

#invalidate_memory_cache(key) ⇒ Object


16
17
18
# File 'lib/gitlab/process_memory_cache/helper.rb', line 16

def invalidate_memory_cache(key)
  touch_cache_timestamp(key)
end