Class: EntityCache::Controls::Storage::Persistent::Example

Inherits:
Object
  • Object
show all
Includes:
Storage::Persistent
Defined in:
lib/entity_cache/controls/storage/persistent.rb

Defined Under Namespace

Modules: Assertions

Constant Summary

Constants included from Storage::Persistent

Storage::Persistent::Error

Instance Attribute Summary

Attributes included from Storage::Persistent

#subject

Instance Method Summary collapse

Methods included from Storage::Persistent

included, #initialize

Instance Method Details

#get(id) ⇒ Object



8
9
10
11
12
# File 'lib/entity_cache/controls/storage/persistent.rb', line 8

def get(id)
  entity, version, time = records[id]

  return entity, version, time
end

#put(id, entity, version, time) ⇒ Object



14
15
16
# File 'lib/entity_cache/controls/storage/persistent.rb', line 14

def put(id, entity, version, time)
  records[id] = [entity, version, time]
end

#recordsObject



18
19
20
# File 'lib/entity_cache/controls/storage/persistent.rb', line 18

def records
  @records ||= {}
end