pymemcache.serde module

class pymemcache.serde.CompressedSerde(compress=<built-in function compress>, decompress=<built-in function decompress>, serde=<pymemcache.serde.PickleSerde object>, min_compress_len=400)

Bases: object

An object which implements the serialization/deserialization protocol for pymemcache.client.base.Client and its descendants with configurable compression.

__init__(compress=<built-in function compress>, decompress=<built-in function decompress>, serde=<pymemcache.serde.PickleSerde object>, min_compress_len=400)
deserialize(key, value, flags)
serialize(key, value)
class pymemcache.serde.LegacyWrappingSerde(serializer_func, deserializer_func)

Bases: object

This class defines how to wrap legacy de/serialization functions into a ‘serde’ object which implements ‘.serialize’ and ‘.deserialize’ methods. It is used automatically by pymemcache.client.base.Client when the ‘serializer’ or ‘deserializer’ arguments are given.

The serializer_func and deserializer_func are expected to be None in the case that they are missing.

__init__(serializer_func, deserializer_func) None
class pymemcache.serde.PickleSerde(pickle_version: int = 4)

Bases: object

An object which implements the serialization/deserialization protocol for pymemcache.client.base.Client and its descendants using the pickle module.

Serialization and deserialization are implemented as methods of this class. To implement a custom serialization/deserialization method for pymemcache, you should implement the same interface as the one provided by this object – pymemcache.serde.PickleSerde.serialize() and pymemcache.serde.PickleSerde.deserialize(). Then, pass your custom object to the pymemcache client object in place of PickleSerde.

For more details on the serialization protocol, see the class documentation for pymemcache.client.base.Client

__init__(pickle_version: int = 4) None
deserialize(key, value, flags)
serialize(key, value)
pymemcache.serde.get_python_memcache_serializer(pickle_version: int = 4)

Return a serializer using a specific pickle version

pymemcache.serde.python_memcache_deserializer(key, value, flags)
pymemcache.serde.python_memcache_serializer(key, value, *, pickle_version=4)