Class: ActiveSupport::Cache::CompressedMemCacheStore

Inherits:
MemCacheStore show all
Defined in:
lib/active_support/cache/compressed_mem_cache_store.rb

Instance Attribute Summary

Attributes inherited from MemCacheStore

#addresses

Instance Method Summary collapse

Methods inherited from MemCacheStore

#clear, #decrement, #delete, #delete_matched, #exist?, #increment, #initialize, #stats

Methods inherited from Store

#decrement, #delete, #delete_matched, #exist?, #fetch, #increment, #initialize, #threadsafe!

Constructor Details

This class inherits a constructor from ActiveSupport::Cache::MemCacheStore

Instance Method Details

#read(name, options = {}) ⇒ Object


4
5
6
7
8
# File 'lib/active_support/cache/compressed_mem_cache_store.rb', line 4

def read(name, options = {})
  if value = super(name, options.merge(:raw => true))
    Marshal.load(ActiveSupport::Gzip.decompress(value))
  end
end

#write(name, value, options = {}) ⇒ Object


10
11
12
# File 'lib/active_support/cache/compressed_mem_cache_store.rb', line 10

def write(name, value, options = {})
  super(name, ActiveSupport::Gzip.compress(Marshal.dump(value)), options.merge(:raw => true))
end