Sha256: 06087cd12a779e02fc94057f7c68d9b55d79a1bb0fb6279d74c91baff193d4c5
Contents?: true
Size: 402 Bytes
Versions: 2
Compression:
Stored size: 402 Bytes
Contents
require 'thread' class LruRedux::ThreadSafeCache < LruRedux::Cache def initialize(size) @lock = Mutex.new super(size) end def self.synchronize(*methods) methods.each do |method| define_method method do |*args, &blk| @lock.synchronize do super(*args,&blk) end end end end synchronize :[], :[]=, :each, :to_a, :delete, :count, :valid? end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
lru_redux-0.0.2 | lib/lru_redux/thread_safe_cache.rb |
lru_redux-0.0.1 | lib/lru_redux/thread_safe_cache.rb |