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-3/

Single-Key Cache with TTL and Compression Toggle

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.

Capabilities

Store value with TTL

  • Storing a value with a positive TTL makes it retrievable before expiry using the same key. @test

Expire after TTL

  • A value stored with a short TTL is not returned after the TTL elapses, and fetching yields the provided default. @test

Optional compression for large payloads

  • When compression is enabled and a payload exceeds the configured threshold, storing and fetching returns the original content intact. @test

No compression when disabled

  • When compression is disabled, large payloads are stored and retrieved without compression-related errors or transformations. @test

Implementation

@generates

API

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."""

Dependencies { .dependencies }

pylibmc { .dependency }

Provides memcached client support for single-key storage with TTL and compression controls.