Quick and small memcached client for Python
86
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.
Install with Tessl CLI
npx tessl i tessl/pypi-pylibmcevals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10