Class: SciYAG::Backends::Cache::CacheEntry
- Inherits:
-
Object
- Object
- SciYAG::Backends::Cache::CacheEntry
- Defined in:
- lib/SciYAG/Backends/cache.rb
Overview
An element of the cache
Instance Attribute Summary collapse
-
#data ⇒ Object
The data cached.
-
#meta_data ⇒ Object
The meta-data that should be matched against when checking the cache’s relevance.
-
#name ⇒ Object
The name under which it is cached.
Instance Method Summary collapse
-
#initialize(name, data, meta_data) ⇒ CacheEntry
constructor
A new instance of CacheEntry.
-
#relevant?(meta_data) ⇒ Boolean
Checks that the meta_data corresponds to this cache entry.
Constructor Details
#initialize(name, data, meta_data) ⇒ CacheEntry
Returns a new instance of CacheEntry.
39 40 41 42 43 44 |
# File 'lib/SciYAG/Backends/cache.rb', line 39 def initialize(name, data, ) @name = name @data = data # Maybe we should even .dup the contents ? @meta_data = .dup # (just to make sure) end |
Instance Attribute Details
#data ⇒ Object
The data cached
33 34 35 |
# File 'lib/SciYAG/Backends/cache.rb', line 33 def data @data end |
#meta_data ⇒ Object
The meta-data that should be matched against when checking the cache’s relevance
37 38 39 |
# File 'lib/SciYAG/Backends/cache.rb', line 37 def @meta_data end |
#name ⇒ Object
The name under which it is cached
30 31 32 |
# File 'lib/SciYAG/Backends/cache.rb', line 30 def name @name end |
Instance Method Details
#relevant?(meta_data) ⇒ Boolean
Checks that the meta_data corresponds to this cache entry
47 48 49 |
# File 'lib/SciYAG/Backends/cache.rb', line 47 def relevant?() return @meta_data == end |