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
-
#has?(object, key) ⇒ Boolean
Class Method Details
.instance ⇒ Object
88
89
90
|
# File 'lib/arid_cache/store.rb', line 88
def self.instance
@@singleton_instance ||= self.new
end
|
Instance Method Details
#add_class_cache_configuration(klass, key, opts, proc) ⇒ Object
100
101
102
|
# File 'lib/arid_cache/store.rb', line 100
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
96
97
98
|
# File 'lib/arid_cache/store.rb', line 96
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
104
105
106
|
# File 'lib/arid_cache/store.rb', line 104
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
84
85
86
|
# File 'lib/arid_cache/store.rb', line 84
def delete!
delete_if { true }
end
|
#find(object, key) ⇒ Object
92
93
94
|
# File 'lib/arid_cache/store.rb', line 92
def find(object, key)
inherited_find(object, key)
end
|
#has?(object, key) ⇒ Boolean
71
72
73
74
75
76
77
78
79
80
81
|
# File 'lib/arid_cache/store.rb', line 71
def has?(object, key)
return true if self.include?(object_store_key(object, key))
store_key = object.is_a?(Class) ? :class_store_key : :instance_store_key
klass = object.is_a?(Class) ? object : object.class
while klass.superclass
return true if self.include?(send(store_key, klass.superclass, key))
klass = klass.superclass
end
false
end
|