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 small cache adapter that stores and retrieves individual entries from a memcached cluster. Each entry should respect a per-item TTL and support optional compression when payloads exceed a configured threshold.
@generates
class CacheAdapter:
def __init__(self, servers: list[str], default_ttl: int = 0, enable_compression: bool = False, compression_threshold: int = 0): ...
def store(self, key: str, value: bytes | str, ttl_seconds: int | None = None) -> None:
"""Store the value with the supplied TTL override or the default TTL."""
def fetch(self, key: str, default: bytes | str | None = None) -> bytes | str | None:
"""Retrieve the value if present and unexpired, otherwise return the default."""Provides memcached client support for single-key storage with TTL and compression controls.