Ctrl + k

or run

tessl search
Log in

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/pylibmc@1.6.x
tile.json

tessl/pypi-pylibmc

tessl install tessl/pypi-pylibmc@1.6.0

Quick 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%

task.mdevals/scenario-5/

Multi-Transport Cache Client Factory

A helper that builds cache clients for TCP, UDP, or UNIX socket endpoints with optional binary protocol and SASL authentication.

Capabilities

Connects to multiple transports

  • Given TCP hosts like ["127.0.0.1:11211", "cache.example.com:11211"], the factory returns a client configured to talk to each endpoint without errors. @test
  • Given UDP endpoints prefixed with udp: and a UNIX socket path (e.g., /tmp/memcached.sock), the factory builds a client that can perform a basic set/get roundtrip through those transports. @test

Binary protocol toggle

  • When use_binary is true, the created client uses the binary protocol while still accepting mixed server definitions. @test

SASL authentication handshake

  • When provided both username and password, the factory enables the binary protocol automatically and returns a client that authenticates via SASL before use. @test
  • If only one of username or password is provided, the factory raises a configuration error before attempting to connect. @test

Implementation

@generates

API

from dataclasses import dataclass
from typing import Iterable, Optional

@dataclass
class ClientConfig:
    servers: Iterable[str]
    use_binary: bool = False
    username: Optional[str] = None
    password: Optional[str] = None

def create_cache_client(config: ClientConfig):
    """Return a ready-to-use cache client configured for the provided servers and optional SASL credentials."""

Dependencies { .dependencies }

pylibmc { .dependency }

Memcached client used to open TCP, UDP, or UNIX socket connections with optional binary protocol and SASL authentication.