Module: ActiveSupport::Cache::Coders::Rails70Coder

Extended by:
Rails70Coder
Includes:
Loader
Included in:
Rails70Coder, MemCacheStore::Coders::Rails70Coder
Defined in:
activesupport/lib/active_support/cache.rb

Instance Method Summary collapse

Methods included from Loader

#load

Instance Method Details

#dump(entry) ⇒ Object



989
990
991
# File 'activesupport/lib/active_support/cache.rb', line 989

def dump(entry)
  MARK_70_UNCOMPRESSED + Marshal.dump(entry.pack)
end

#dump_compressed(entry, threshold) ⇒ Object



993
994
995
996
997
998
999
1000
1001
1002
1003
# File 'activesupport/lib/active_support/cache.rb', line 993

def dump_compressed(entry, threshold)
  payload = Marshal.dump(entry.pack)
  if payload.bytesize >= threshold
    compressed_payload = Zlib::Deflate.deflate(payload)
    if compressed_payload.bytesize < payload.bytesize
      return MARK_70_COMPRESSED + compressed_payload
    end
  end

  MARK_70_UNCOMPRESSED + payload
end