Module: Pre::Cache::Fake

Defined in:
lib/pre/cache_store/fake.rb

Instance Method Summary collapse

Instance Method Details

#cacheObject



4
5
6
# File 'lib/pre/cache_store/fake.rb', line 4

def cache
  @cache ||= {}
end

#cache_fetch(key, &block) ⇒ Object



13
14
15
# File 'lib/pre/cache_store/fake.rb', line 13

def cache_fetch key, &block
  cache[key] ||= block.call
end

#cache_read(key) ⇒ Object



7
8
9
# File 'lib/pre/cache_store/fake.rb', line 7

def cache_read key
  cache[key]
end

#cache_write(key, value) ⇒ Object



10
11
12
# File 'lib/pre/cache_store/fake.rb', line 10

def cache_write key, value
  cache[key] = value
end