Class: Philiprehberger::Template::Cache

Inherits:
Object
  • Object
show all
Defined in:
lib/philiprehberger/template/cache.rb

Instance Method Summary collapse

Constructor Details

#initializeCache

Returns a new instance of Cache.



6
7
8
# File 'lib/philiprehberger/template/cache.rb', line 6

def initialize
  @store = {}
end

Instance Method Details

#clearObject



22
23
24
# File 'lib/philiprehberger/template/cache.rb', line 22

def clear
  @store.clear
end

#delete(key) ⇒ Object



18
19
20
# File 'lib/philiprehberger/template/cache.rb', line 18

def delete(key)
  @store.delete(key)
end

#fetch(key) ⇒ Object



10
11
12
# File 'lib/philiprehberger/template/cache.rb', line 10

def fetch(key)
  @store[key]
end

#key?(key) ⇒ Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/philiprehberger/template/cache.rb', line 30

def key?(key)
  @store.key?(key)
end

#sizeObject



26
27
28
# File 'lib/philiprehberger/template/cache.rb', line 26

def size
  @store.size
end

#store(key, compiled_template) ⇒ Object



14
15
16
# File 'lib/philiprehberger/template/cache.rb', line 14

def store(key, compiled_template)
  @store[key] = compiled_template
end