Class: Philiprehberger::Template::Cache
- Inherits:
-
Object
- Object
- Philiprehberger::Template::Cache
- Defined in:
- lib/philiprehberger/template/cache.rb
Instance Method Summary collapse
- #clear ⇒ Object
- #delete(key) ⇒ Object
- #fetch(key) ⇒ Object
-
#initialize ⇒ Cache
constructor
A new instance of Cache.
- #key?(key) ⇒ Boolean
- #size ⇒ Object
- #store(key, compiled_template) ⇒ Object
Constructor Details
#initialize ⇒ Cache
Returns a new instance of Cache.
6 7 8 |
# File 'lib/philiprehberger/template/cache.rb', line 6 def initialize @store = {} end |
Instance Method Details
#clear ⇒ Object
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
30 31 32 |
# File 'lib/philiprehberger/template/cache.rb', line 30 def key?(key) @store.key?(key) end |
#size ⇒ Object
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 |