Class: LRUCache::ThreadSafe
Constant Summary
Constants inherited
from LRUCache
Error, InvalidLimitError, NoLimitError
Instance Attribute Summary
Attributes inherited from LRUCache
#limit
Instance Method Summary
collapse
Constructor Details
#initialize(limit = nil) ⇒ ThreadSafe
Returns a new instance of ThreadSafe.
6
7
8
9
|
# File 'lib/lru_cache/thread_safe.rb', line 6
def initialize(limit=nil)
super
@mutex = Mutex.new
end
|
Instance Method Details
#clear ⇒ Object
15
16
17
|
# File 'lib/lru_cache/thread_safe.rb', line 15
def clear
@mutex.synchronize { super }
end
|
#count ⇒ Object
11
12
13
|
# File 'lib/lru_cache/thread_safe.rb', line 11
def count
@mutex.synchronize { super }
end
|
#delete(key) ⇒ Object
19
20
21
|
# File 'lib/lru_cache/thread_safe.rb', line 19
def delete(key)
@mutex.synchronize { super }
end
|
#get(key) ⇒ Object
Also known as:
[]
23
24
25
|
# File 'lib/lru_cache/thread_safe.rb', line 23
def get(key)
@mutex.synchronize { super }
end
|
#limit=(new_limit) ⇒ Object
27
28
29
|
# File 'lib/lru_cache/thread_safe.rb', line 27
def limit=(new_limit)
@mutex.synchronize { super }
end
|
#set(key, value) ⇒ Object
Also known as:
[]=
31
32
33
|
# File 'lib/lru_cache/thread_safe.rb', line 31
def set(key, value)
@mutex.synchronize { super }
end
|