Module: Stacks::Cache

Included in:
ColumnDependentCache, MethodCache, ReportCache
Defined in:
lib/stacks/cache.rb

Instance Method Summary collapse

Instance Method Details

#get_value(item, backend, ttl) ⇒ Object



3
4
5
6
7
8
9
10
11
# File 'lib/stacks/cache.rb', line 3

def get_value(item, backend, ttl)
  return item.value if Stacks.deactivate

  if Stacks.restrict
    return item.value unless Stacks.restrict.call
  end

  backend.get_or_set(item, ttl)
end