module ActiveSupport::Cache::SerializerWithFallback
def self.[](format)
def self.[](format) if format.to_s.include?("message_pack") && !defined?(ActiveSupport::MessagePack) require "active_support/message_pack" end SERIALIZERS.fetch(format) end
def load(dumped)
def load(dumped) if dumped.is_a?(String) case when MessagePackWithFallback.dumped?(dumped) MessagePackWithFallback._load(dumped) when Marshal71WithFallback.dumped?(dumped) Marshal71WithFallback._load(dumped) when Marshal70WithFallback.dumped?(dumped) Marshal70WithFallback._load(dumped) else Cache::Store.logger&.warn("Unrecognized payload prefix #{dumped.byteslice(0).inspect}; deserializing as nil") nil end elsif PassthroughWithFallback.dumped?(dumped) PassthroughWithFallback._load(dumped) else Cache::Store.logger&.warn("Unrecognized payload class #{dumped.class}; deserializing as nil") nil end end
def marshal_load(payload)
def marshal_load(payload) Marshal.load(payload) rescue ArgumentError => error raise Cache::DeserializationError, error.message end