diff options
author | Joshua Peek <josh@joshpeek.com> | 2008-08-06 17:03:42 -0500 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2008-08-06 17:03:42 -0500 |
commit | fbc6129acd9ecb6b7435931b472d3226985ba4c4 (patch) | |
tree | 86db90105839e372fe215d3c930d18245cd94734 | |
parent | dfc83566b3f52b4b84db52312c01fcc3b8847059 (diff) | |
download | rails-fbc6129acd9ecb6b7435931b472d3226985ba4c4.tar.gz rails-fbc6129acd9ecb6b7435931b472d3226985ba4c4.tar.bz2 rails-fbc6129acd9ecb6b7435931b472d3226985ba4c4.zip |
Treat single C operations in MemoryStore as atomic
-rw-r--r-- | activesupport/lib/active_support/cache/memory_store.rb | 31 |
1 files changed, 8 insertions, 23 deletions
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 |