Class: CanTango::Ability::Cache::MonetaCache

Inherits:
Object
  • Object
show all
Defined in:
lib/cantango/ability/cache/moneta_cache.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, options = {}) ⇒ MonetaCache

for a YamlStore, the name is the name of the yml file



12
13
14
15
16
# File 'lib/cantango/ability/cache/moneta_cache.rb', line 12

def initialize name, options = {}
  super
  @store = CanTango::Cache::MonetaCache.instance
  @store.configure_with options
end

Instance Attribute Details

#storeObject (readonly)

one cache store is shared for all store instances (w different names)



9
10
11
# File 'lib/cantango/ability/cache/moneta_cache.rb', line 9

def store
  @store
end

Instance Method Details

#invalidate!(key) ⇒ Object



26
27
28
# File 'lib/cantango/ability/cache/moneta_cache.rb', line 26

def invalidate! key
  store.delete key
end

#load(key) ⇒ Object



18
19
20
# File 'lib/cantango/ability/cache/moneta_cache.rb', line 18

def load key
  store.load! key
end

#save(key, rules) ⇒ Object



22
23
24
# File 'lib/cantango/ability/cache/moneta_cache.rb', line 22

def save key, rules
  store.save! key, rules
end