instiki/vendor/rails/activesupport/lib/active_support/cache/synchronized_memory_store.rb
Jacques Distler 2e81ca2d30 Rails 2.2.2
Updated to Rails 2.2.2.
Added a couple more Ruby 1.9 fixes, but that's pretty much at a standstill,
until one gets Maruku and HTML5lib working right under Ruby 1.9.
2008-11-24 15:53:39 -06:00

48 lines
978 B
Ruby

module ActiveSupport
module Cache
# Like MemoryStore, but thread-safe.
class SynchronizedMemoryStore < MemoryStore
def initialize
super
@guard = Monitor.new
end
def fetch(key, options = {})
@guard.synchronize { super }
end
def read(name, options = nil)
@guard.synchronize { super }
end
def write(name, value, options = nil)
@guard.synchronize { super }
end
def delete(name, options = nil)
@guard.synchronize { super }
end
def delete_matched(matcher, options = nil)
@guard.synchronize { super }
end
def exist?(name,options = nil)
@guard.synchronize { super }
end
def increment(key, amount = 1)
@guard.synchronize { super }
end
def decrement(key, amount = 1)
@guard.synchronize { super }
end
def clear
@guard.synchronize { super }
end
end
end
end