Methods
- #
- D
Included Modules
Constants
| MARK_COMPRESSED | = | "\x01".b.freeze |
| MARK_UNCOMPRESSED | = | "\x00".b.freeze |
Instance Public methods
_load(marked) Link
# File activesupport/lib/active_support/cache/serializer_with_fallback.rb, line 88 def _load(marked) dumped = marked.byteslice(1..-1) if marked.start_with?(MARK_COMPRESSED) dumped = begin Zlib::Inflate.inflate(dumped) rescue Zlib::Error => error raise Cache::DeserializationError, "#{error.class}: #{error.message}" end end Cache::Entry.unpack(marshal_load(dumped)) end
dump(entry) Link
dump_compressed(entry, threshold) Link
# File activesupport/lib/active_support/cache/serializer_with_fallback.rb, line 77 def dump_compressed(entry, threshold) dumped = Marshal.dump(entry.pack) if dumped.bytesize >= threshold compressed = Zlib::Deflate.deflate(dumped) return MARK_COMPRESSED + compressed if compressed.bytesize < dumped.bytesize end MARK_UNCOMPRESSED + dumped end