Module: ActiveSupport::Cache::SerializerWithFallback
Do not use. This module is for internal use only.
Relationships & Source Files | |
Namespace Children | |
Modules:
| |
Extension / Inclusion / Inheritance Descendants | |
Included In:
| |
Defined in: | activesupport/lib/active_support/cache/serializer_with_fallback.rb |
Constant Summary
-
SERIALIZERS =
# File 'activesupport/lib/active_support/cache/serializer_with_fallback.rb', line 144{ passthrough: PassthroughWithFallback, marshal_7_0: Marshal70WithFallback, marshal_7_1: Marshal71WithFallback, message_pack: MessagePackWithFallback, }
Class Method Summary
Instance Method Summary
- #load(dumped)
- #marshal_load(payload) private
Class Method Details
.[](format)
[ GitHub ]# File 'activesupport/lib/active_support/cache/serializer_with_fallback.rb', line 9
def self.[](format) if format.to_s.include?("message_pack") && !defined?(ActiveSupport::MessagePack) require "active_support/message_pack" end SERIALIZERS.fetch(format) end
Instance Method Details
#load(dumped)
[ GitHub ]# File 'activesupport/lib/active_support/cache/serializer_with_fallback.rb', line 17
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
#marshal_load(payload) (private)
[ GitHub ]# File 'activesupport/lib/active_support/cache/serializer_with_fallback.rb', line 39
def marshal_load(payload) Marshal.load(payload) rescue ArgumentError => error raise Cache::DeserializationError, error. end