Class: CanTango::Cache::HashCache
- Inherits:
-
Object
- Object
- CanTango::Cache::HashCache
- Includes:
- Singleton
- Defined in:
- lib/cantango/cache/hash_cache.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #cache ⇒ Object
- #configure_with(options = {}) ⇒ Object
- #delete(key) ⇒ Object
- #load!(key) ⇒ Object
- #save!(key, rules) ⇒ Object
- #type ⇒ Object
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
6 7 8 |
# File 'lib/cantango/cache/hash_cache.rb', line 6 def @options end |
Instance Method Details
#cache ⇒ Object
24 25 26 |
# File 'lib/cantango/cache/hash_cache.rb', line 24 def cache @cache ||= {} end |
#configure_with(options = {}) ⇒ Object
8 9 10 |
# File 'lib/cantango/cache/hash_cache.rb', line 8 def configure_with = {} @options ||= end |
#delete(key) ⇒ Object
20 21 22 |
# File 'lib/cantango/cache/hash_cache.rb', line 20 def delete key cache[key].delete if cache[key] end |
#load!(key) ⇒ Object
12 13 14 |
# File 'lib/cantango/cache/hash_cache.rb', line 12 def load! key cache[key] end |
#save!(key, rules) ⇒ Object
16 17 18 |
# File 'lib/cantango/cache/hash_cache.rb', line 16 def save! key, rules cache[key] = rules end |
#type ⇒ Object
28 29 30 |
# File 'lib/cantango/cache/hash_cache.rb', line 28 def type :memory end |