tessl install tessl/pypi-pylibmc@1.6.0Quick and small memcached client for Python
Agent Success
Agent success rate when using this tile
86%
Improvement
Agent success rate improvement when using this tile compared to baseline
1.04x
Baseline
Agent success rate without this tile
83%
Build a cache adapter that customizes encoding and decoding rules for a memcached-backed client, registering its hooks so cache operations honor custom flags and treating unknown flags as misses.
@generates
class FlagAwareCacheAdapter:
def __init__(self, backend, json_flag: int = 0x99, raw_flag: int = 0):
...
def set(self, key: str, value, ttl: int = 0) -> bool:
"""Store a value with optional TTL using the backend."""
def get(self, key: str, default=None):
"""Fetch a value, returning default when treating data as a miss."""
def serialize(self, value) -> tuple[bytes, int]:
"""Encode a value and return (payload, flag) pair for backend storage."""
def deserialize(self, data: bytes, flag: int):
"""Decode backend payloads, treating unsupported flags as cache misses."""Memcached client that allows overriding serialization hooks and using cache-miss sentinels.