Class: CanTango::Cache::HashCache

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/cantango/cache/hash_cache.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



6
7
8
# File 'lib/cantango/cache/hash_cache.rb', line 6

def options
  @options
end

Instance Method Details

#cacheObject



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 = {}
  @options ||= 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

#typeObject



28
29
30
# File 'lib/cantango/cache/hash_cache.rb', line 28

def type
  :memory
end