123456789_123456789_123456789_123456789_123456789_

Module: ActiveSupport::Cache::MemoryStore::DupCoder

Do not use. This module is for internal use only.
Relationships & Source Files
Defined in: activesupport/lib/active_support/cache/memory_store.rb

Constant Summary

Instance Method Summary

Instance Method Details

#dump(entry)

[ GitHub ]

  
# File 'activesupport/lib/active_support/cache/memory_store.rb', line 32

def dump(entry)
  if entry.value && entry.value != true && !entry.value.is_a?(Numeric)
    Cache::Entry.new(dump_value(entry.value), expires_at: entry.expires_at, version: entry.version)
  else
    entry
  end
end

#dump_compressed(entry, threshold)

[ GitHub ]

  
# File 'activesupport/lib/active_support/cache/memory_store.rb', line 40

def dump_compressed(entry, threshold)
  compressed_entry = entry.compressed(threshold)
  compressed_entry.compressed? ? compressed_entry : dump(entry)
end

#dump_value(value) (private)

[ GitHub ]

  
# File 'activesupport/lib/active_support/cache/memory_store.rb', line 56

def dump_value(value)
  if value.is_a?(String) && !value.start_with?(MARSHAL_SIGNATURE)
    value.dup
  else
    Marshal.dump(value)
  end
end

#load(entry)

[ GitHub ]

  
# File 'activesupport/lib/active_support/cache/memory_store.rb', line 45

def load(entry)
  if !entry.compressed? && entry.value.is_a?(String)
    Cache::Entry.new(load_value(entry.value), expires_at: entry.expires_at, version: entry.version)
  else
    entry
  end
end

#load_value(string) (private)

[ GitHub ]

  
# File 'activesupport/lib/active_support/cache/memory_store.rb', line 64

def load_value(string)
  if string.start_with?(MARSHAL_SIGNATURE)
    Marshal.load(string)
  else
    string.dup
  end
end