Class: SciYAG::Backends::Cache::CacheEntry

Inherits:
Object
  • Object
show all
Defined in:
lib/SciYAG/Backends/cache.rb

Overview

An element of the cache

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#dataObject

The data cached



33
34
35
# File 'lib/SciYAG/Backends/cache.rb', line 33

def data
  @data
end

#meta_dataObject

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

#nameObject

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

Returns:

  • (Boolean)


47
48
49
# File 'lib/SciYAG/Backends/cache.rb', line 47

def relevant?()
  return @meta_data == 
end