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

Extended by:
DupCoder
Included in:
DupCoder
Defined in:
lib/active_support/cache/memory_store.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#dump(entry) ⇒ Object



32
33
34
35
36
37
38
# File '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) ⇒ Object



40
41
42
43
# File '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

#load(entry) ⇒ Object



45
46
47
48
49
50
51
# File '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