Class: ActiveSupport::Cache::CompressedLibmemcachedStore

Inherits:
LibmemcachedStore show all
Defined in:
lib/active_support/cache/compressed_libmemcached_store.rb

Constant Summary

Constants inherited from LibmemcachedStore

LibmemcachedStore::DEFAULT_OPTIONS

Instance Attribute Summary

Attributes inherited from LibmemcachedStore

#addresses

Instance Method Summary collapse

Methods inherited from LibmemcachedStore

#clear, #decrement, #increment, #initialize, #stats

Constructor Details

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

Instance Method Details

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



4
5
6
7
8
# File 'lib/active_support/cache/compressed_libmemcached_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_libmemcached_store.rb', line 10

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