Class: OGLRUCache
- Inherits:
-
LRUCache
- Object
- LRUCache
- OGLRUCache
- Defined in:
- lib/ObjectModel/Tools/OGLRUCache.rb
Overview
It should have max_items at least equal to 1!
Defined Under Namespace
Classes: EntityContainer
Instance Method Summary collapse
- #[](key) ⇒ Object
- #[]=(key, item) ⇒ Object
-
#initialize(repository, percentage) ⇒ OGLRUCache
constructor
A new instance of OGLRUCache.
- #update(transaction) ⇒ Object
Constructor Details
#initialize(repository, percentage) ⇒ OGLRUCache
Returns a new instance of OGLRUCache.
12 13 14 15 16 |
# File 'lib/ObjectModel/Tools/OGLRUCache.rb', line 12 def initialize repository, percentage @repository, @percentage = repository, percentage super(1) update_size end |
Instance Method Details
#[](key) ⇒ Object
18 19 20 21 |
# File 'lib/ObjectModel/Tools/OGLRUCache.rb', line 18 def [](key) container = super(key) nil == container ? nil : container.entity end |
#[]=(key, item) ⇒ Object
23 24 25 26 |
# File 'lib/ObjectModel/Tools/OGLRUCache.rb', line 23 def []=(key, item) container = EntityContainer.new item super(key, container) end |
#update(transaction) ⇒ Object
28 29 30 31 |
# File 'lib/ObjectModel/Tools/OGLRUCache.rb', line 28 def update transaction transaction.copies.each{|entity_id, c| delete entity_id if c.deleted?} update_size end |