module ActiveSupport::Cache::MemoryStore::DupCoder
def dump(entry)
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
def dump_compressed(entry, threshold)
def dump_compressed(entry, threshold) compressed_entry = entry.compressed(threshold) compressed_entry.compressed? ? compressed_entry : dump(entry) end
def dump_value(value)
def dump_value(value) if value.is_a?(String) && !value.start_with?(MARSHAL_SIGNATURE) value.dup else Marshal.dump(value) end end
def load(entry)
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
def load_value(string)
def load_value(string) if string.start_with?(MARSHAL_SIGNATURE) Marshal.load(string) else string.dup end end