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%
Configure a memcached client that always uses the binary protocol with SASL authentication and exposes a simple health check.
ping style call stores and retrieves a sentinel value using the authenticated client and returns True on success. @test@generates
from dataclasses import dataclass
from typing import Iterable, Any
@dataclass
class CacheAuth:
servers: Iterable[str]
username: str
password: str
timeout: float | None = None
def build_authenticated_client(config: CacheAuth) -> Any:
"""Create a cache client that uses the binary protocol with SASL credentials, raising on invalid configuration."""
def ping_cache(client: Any, key: str = "__ping__", ttl: int = 5) -> bool:
"""Perform an authenticated write/read using the given client; returns True on success, raises on authentication failures."""Memcached client with binary protocol and SASL support.