Quick and small memcached client for Python
86
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.
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