pymemcache.serde module

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.

class pymemcache.serde.PickleSerde(pickle_version=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

deserialize(key, value, flags)
serialize(key, value)

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)