class EntityCache::Store::External::Substitute::External
Attributes
telemetry_sink[RW]
Public Class Methods
build()
click to toggle source
# File lib/entity_cache/store/external/substitute.rb, line 14 def self.build instance = new(subject) instance.configure instance end
subject()
click to toggle source
# File lib/entity_cache/store/external/substitute.rb, line 57 def self.subject :substitute end
Public Instance Methods
add(id, entity, version, time)
click to toggle source
# File lib/entity_cache/store/external/substitute.rb, line 36 def add(id, entity, version, time) record = Record.new(id, entity, version, time) get_records[id] = record record end
configure(session: nil)
click to toggle source
# File lib/entity_cache/store/external/substitute.rb, line 20 def configure(session: nil) self.telemetry_sink = self.class.register_telemetry_sink(self) end
get(id)
click to toggle source
# File lib/entity_cache/store/external/substitute.rb, line 24 def get(id) record = get_records[id] if record return record.entity, record.version, record.time end end
get_records()
click to toggle source
# File lib/entity_cache/store/external/substitute.rb, line 32 def get_records @get_records ||= {} end
put(*)
click to toggle source
# File lib/entity_cache/store/external/substitute.rb, line 44 def put(*) end
put?(&block)
click to toggle source
# File lib/entity_cache/store/external/substitute.rb, line 47 def put?(&block) block ||= proc { true } telemetry_sink.recorded_put? do |record| data = record.data block.(data.id, data.entity, data.version, data.time) end end