aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support
diff options
context:
space:
mode:
authorgrosser <grosser.michael@gmail.com>2012-05-10 08:19:45 -0700
committergrosser <grosser.michael@gmail.com>2012-05-10 08:19:45 -0700
commitb5005b6259144eeea5b903d659f54bd8a0343d25 (patch)
tree5448e7da507620364a7911cec955a429ce7e7247 /activesupport/lib/active_support
parentdd9ea8d4dededdad2c6de23260a24b2835fb2fbd (diff)
downloadrails-b5005b6259144eeea5b903d659f54bd8a0343d25.tar.gz
rails-b5005b6259144eeea5b903d659f54bd8a0343d25.tar.bz2
rails-b5005b6259144eeea5b903d659f54bd8a0343d25.zip
add unless_exist option to memory store
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r--activesupport/lib/active_support/cache/memory_store.rb1
1 files changed, 1 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/cache/memory_store.rb b/activesupport/lib/active_support/cache/memory_store.rb
index b15bb42c88..7fd5e3b53d 100644
--- a/activesupport/lib/active_support/cache/memory_store.rb
+++ b/activesupport/lib/active_support/cache/memory_store.rb
@@ -137,6 +137,7 @@ module ActiveSupport
def write_entry(key, entry, options) # :nodoc:
synchronize do
old_entry = @data[key]
+ return false if @data.key?(key) && options[:unless_exist]
@cache_size -= old_entry.size if old_entry
@cache_size += entry.size
@key_access[key] = Time.now.to_f