File: active_support/cache/compressed_mem_cache_store.rb

Overview
Module Structure
Class Hierarchy
Code

Overview

Module Structure

  module: <Toplevel Module>
  module: ActiveSupport#1
  module: Cache#2
  class: CompressedMemCacheStore#3
inherits from
  MemCacheStore ( ActiveSupport::Cache )
has properties
method: read / 2 #4
method: write / 3 #14

Code

   1  module ActiveSupport
   2    module Cache
   3      class CompressedMemCacheStore < MemCacheStore
   4        def read(name, options = nil)
   5          if value = super(name, (options || {}).merge(:raw => true))
   6            if raw?(options)
   7              value
   8            else
   9              Marshal.load(ActiveSupport::Gzip.decompress(value))
  10            end
  11          end
  12        end
  13 
  14        def write(name, value, options = nil)
  15          value = ActiveSupport::Gzip.compress(Marshal.dump(value)) unless raw?(options)
  16          super(name, value, (options || {}).merge(:raw => true))
  17        end
  18      end
  19    end
  20  end