From fbc6129acd9ecb6b7435931b472d3226985ba4c4 Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Wed, 6 Aug 2008 17:03:42 -0500 Subject: Treat single C operations in MemoryStore as atomic --- .../lib/active_support/cache/memory_store.rb | 31 ++++++---------------- 1 file changed, 8 insertions(+), 23 deletions(-) (limited to 'activesupport/lib') diff --git a/activesupport/lib/active_support/cache/memory_store.rb b/activesupport/lib/active_support/cache/memory_store.rb index 9332d50f24..a44f877414 100644 --- a/activesupport/lib/active_support/cache/memory_store.rb +++ b/activesupport/lib/active_support/cache/memory_store.rb @@ -13,38 +13,25 @@ module ActiveSupport end def read(name, options = nil) - @mutex.synchronize do - super - @data[name] - end + super + @data[name] end def write(name, value, options = nil) - @mutex.synchronize do - super - @data[name] = value - end + super + @data[name] = value end def delete(name, options = nil) - @mutex.synchronize do - super - @data.delete(name) - end + @data.delete(name) end def delete_matched(matcher, options = nil) - @mutex.synchronize do - super - @data.delete_if { |k,v| k =~ matcher } - end + @data.delete_if { |k,v| k =~ matcher } end def exist?(name,options = nil) - @mutex.synchronize do - super - @data.has_key?(name) - end + @data.has_key?(name) end def increment(key, amount = 1) @@ -60,9 +47,7 @@ module ActiveSupport end def clear - @mutex.synchronize do - @data.clear - end + @data.clear end end end -- cgit v1.2.3