forked from pool/python-dogpile.cache
- Fixed regression where the serialization and deserialization
functions could be inadvertently turned into instance methods with
an unexpected argument signature, namely when pickle.dumps and
pickle.loads are the pure Python version as is the case in pypy.
- 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 the CachedValue and not to the metadata or other
portions of CachedValue object itself, so the serialized portion is
effectively a "payload" within the larger CachedValue 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 backend BytesBackend 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.
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-dogpile.cache?expand=0&rev=60
2.3 KiB
2.3 KiB