1.1.0
1.1.0
Released: Sun Nov 15 2020
feature
-
[feature] [region] Reworked the means by which values are serialized and deserialized from
backends, and provided for custom serialization of values. Added the
CacheRegion.serializer
and
CacheRegion.deserializer
parameters which may be set to any
serializer.Serialization and deserialization now take place within the
CacheRegion
so that backends may now assume string values
in all cases. This simplifies the existing backends and also makes
custom backends easier to write and maintain.Additionally, the serializer is now applied to the user-defined value
portion of theCachedValue
and not to the metadata or other
portions ofCachedValue
object itself, so the serialized portion
is effectively a "payload" within the largerCachedValue
structure that is passed as part of the larger string format. The overall
format is a separate JSON of the cached value metadata, followed by the
serialized form. This allows for end-user serialization schemes that are
hardwired to the values themselves without the need to serialize dogpile's
internal structures as well.Existing custom backends should continue to work without issue; they
now have the option to forego any separate serialization steps, and
can also subclass a new backendBytesBackend
that marks them
as a backend that only deals with bytes coming in and out; all
internal serialization logic from such a backend can be removed.Pull request courtesy Alessio Bogon.
References: #191
misc
- [change] Added pep-484 annotations to most of the dogpile.cache package.