Class: LruRedux::ThreadSafeCache

Inherits:
Cache
  • Object
show all
Includes:
MonitorMixin
Defined in:
lib/lru_redux/thread_safe_cache.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Cache

#[], #[]=, #clear, #count, #delete, #each, #fetch, #getset, #max_size=, #to_a, #valid?

Constructor Details

#initialize(size) ⇒ ThreadSafeCache

Returns a new instance of ThreadSafeCache.



6
7
8
# File 'lib/lru_redux/thread_safe_cache.rb', line 6

def initialize(size)
  super(size)
end

Class Method Details

.synchronize(*methods) ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'lib/lru_redux/thread_safe_cache.rb', line 10

def self.synchronize(*methods)
  methods.each do |method|
    define_method method do |*args, &blk|
      synchronize do
        super(*args,&blk)
      end
    end
  end
end