diff options
author | Doug Barth <dougbarth@gmail.com> | 2008-10-09 10:47:32 -0500 |
---|---|---|
committer | Michael Koziarski <michael@koziarski.com> | 2008-10-17 18:09:27 +0200 |
commit | 4b63c2700ffc5c646af0e728d4ec2fcb6770671b (patch) | |
tree | e0b504b733cf534f5822f976f312e3fe6ec6e1f6 /activesupport/lib/active_support/cache/compressed_mem_cache_store.rb | |
parent | c3d6205a4ba92e25f1092ac9c1f4e72ee3c796ed (diff) | |
download | rails-4b63c2700ffc5c646af0e728d4ec2fcb6770671b.tar.gz rails-4b63c2700ffc5c646af0e728d4ec2fcb6770671b.tar.bz2 rails-4b63c2700ffc5c646af0e728d4ec2fcb6770671b.zip |
Bring MemCacheStore and CompressedMemCacheStore inline with expected counter manipulation semantics.
Signed-off-by: Michael Koziarski <michael@koziarski.com>
Diffstat (limited to 'activesupport/lib/active_support/cache/compressed_mem_cache_store.rb')
-rw-r--r-- | activesupport/lib/active_support/cache/compressed_mem_cache_store.rb | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/cache/compressed_mem_cache_store.rb b/activesupport/lib/active_support/cache/compressed_mem_cache_store.rb index 0bff6cf9ad..d87eb17337 100644 --- a/activesupport/lib/active_support/cache/compressed_mem_cache_store.rb +++ b/activesupport/lib/active_support/cache/compressed_mem_cache_store.rb @@ -3,12 +3,17 @@ module ActiveSupport class CompressedMemCacheStore < MemCacheStore def read(name, options = nil) if value = super(name, (options || {}).merge(:raw => true)) - Marshal.load(ActiveSupport::Gzip.decompress(value)) + if raw?(options) + value + else + Marshal.load(ActiveSupport::Gzip.decompress(value)) + end end end def write(name, value, options = nil) - super(name, ActiveSupport::Gzip.compress(Marshal.dump(value)), (options || {}).merge(:raw => true)) + value = ActiveSupport::Gzip.compress(Marshal.dump(value)) unless raw?(options) + super(name, value, (options || {}).merge(:raw => true)) end end end |