Class: AridCache::Store
- Inherits:
-
Hash
- Object
- Hash
- AridCache::Store
show all
- Defined in:
- lib/arid_cache/store.rb
Defined Under Namespace
Classes: Blueprint, ClassCacheConfiguration, Configuration, InstanceCacheConfiguration
Class Method Summary
collapse
Instance Method Summary
collapse
-
#add_class_cache_configuration(klass, key, opts, proc) ⇒ Object
-
#add_instance_cache_configuration(klass, key, opts, proc) ⇒ Object
-
#add_object_cache_configuration(object, key, opts, proc) ⇒ Object
-
#delete! ⇒ Object
-
#find(object, key) ⇒ Object
-
#find_or_create(object, key) ⇒ Object
-
#has?(object, key) ⇒ Boolean
Class Method Details
.instance ⇒ Object
80
81
82
|
# File 'lib/arid_cache/store.rb', line 80
def self.instance
@@singleton_instance ||= self.new
end
|
Instance Method Details
#add_class_cache_configuration(klass, key, opts, proc) ⇒ Object
92
93
94
|
# File 'lib/arid_cache/store.rb', line 92
def add_class_cache_configuration(klass, key, opts, proc)
add_generic_cache_configuration(class_store_key(klass, key), klass, key, opts, proc)
end
|
#add_instance_cache_configuration(klass, key, opts, proc) ⇒ Object
88
89
90
|
# File 'lib/arid_cache/store.rb', line 88
def add_instance_cache_configuration(klass, key, opts, proc)
add_generic_cache_configuration(instance_store_key(klass, key), klass, key, opts, proc)
end
|
#add_object_cache_configuration(object, key, opts, proc) ⇒ Object
96
97
98
|
# File 'lib/arid_cache/store.rb', line 96
def add_object_cache_configuration(object, key, opts, proc)
add_generic_cache_configuration(object_store_key(object, key), object, key, opts, proc)
end
|
#delete! ⇒ Object
76
77
78
|
# File 'lib/arid_cache/store.rb', line 76
def delete!
delete_if { true }
end
|
#find(object, key) ⇒ Object
84
85
86
|
# File 'lib/arid_cache/store.rb', line 84
def find(object, key)
self[object_store_key(object, key)]
end
|
#find_or_create(object, key) ⇒ Object
100
101
102
103
104
105
106
107
|
# File 'lib/arid_cache/store.rb', line 100
def find_or_create(object, key)
store_key = object_store_key(object, key)
if self.include?(store_key)
self[store_key]
else
self[store_key] = AridCache::Store::Blueprint.new(object, key)
end
end
|
#has?(object, key) ⇒ Boolean
71
72
73
|
# File 'lib/arid_cache/store.rb', line 71
def has?(object, key)
self.include?(object_store_key(object, key))
end
|