Class: LookupBy::Caching::SafeLRU
- Defined in:
- lib/lookup_by/caching/safe_lru.rb
Instance Attribute Summary
Attributes inherited from LRU
Instance Method Summary collapse
- #[](key) ⇒ Object
- #[]=(key, value) ⇒ Object
- #clear ⇒ Object
- #delete(key) ⇒ Object
-
#initialize(maxsize = nil) ⇒ SafeLRU
constructor
A new instance of SafeLRU.
- #merge!(hash) ⇒ Object
Methods inherited from LRU
Constructor Details
#initialize(maxsize = nil) ⇒ SafeLRU
Returns a new instance of SafeLRU.
4 5 6 7 |
# File 'lib/lookup_by/caching/safe_lru.rb', line 4 def initialize(maxsize = nil) @mutex = Mutex.new super end |
Instance Method Details
#[](key) ⇒ Object
13 14 15 |
# File 'lib/lookup_by/caching/safe_lru.rb', line 13 def [](key) @mutex.synchronize { super } end |
#[]=(key, value) ⇒ Object
17 18 19 |
# File 'lib/lookup_by/caching/safe_lru.rb', line 17 def []=(key, value) @mutex.synchronize { super } end |
#clear ⇒ Object
9 10 11 |
# File 'lib/lookup_by/caching/safe_lru.rb', line 9 def clear @mutex.synchronize { super } end |
#delete(key) ⇒ Object
25 26 27 |
# File 'lib/lookup_by/caching/safe_lru.rb', line 25 def delete(key) @mutex.synchronize { super } end |
#merge!(hash) ⇒ Object
21 22 23 |
# File 'lib/lookup_by/caching/safe_lru.rb', line 21 def merge!(hash) @mutex.synchronize { super } end |