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

Adaptive Cache Compression Overrides

A helper around a memcached client that applies per-write compression thresholds and compression levels while keeping sensible defaults for future operations.

Capabilities

Default thresholds and levels set at construction are used whenever per-call overrides are omitted.

Per-item compression thresholds

  • Using store with an override threshold of 256 bytes, storing a ~100-byte payload and then a ~1KB payload both return True and load returns the original bytes for each; the override only applies to that call. @test

Compression level overrides

  • When a write specifies a custom compression level, the value round-trips correctly and later writes without an override fall back to the default level set at construction. @test

Bulk writes honor shared overrides

  • Writing multiple entries with shared threshold and level overrides persists all entries, returns an empty sequence for failures, and each entry can be retrieved unchanged. @test

Implementation

@generates

API

from typing import Any, Mapping, Optional, Sequence

class AdaptiveCache:
    def __init__(self, client, default_min_bytes: int = 0, default_level: int = -1) -> None:
        ...

    def store(self, key: str, value: Any, *, min_bytes: Optional[int] = None, level: Optional[int] = None) -> bool:
        ...

    def store_many(self, values: Mapping[str, Any], *, min_bytes: Optional[int] = None, level: Optional[int] = None) -> Sequence[str]:
        ...

    def load(self, key: str, default: Any = None) -> Any:
        ...

Dependencies { .dependencies }

pylibmc { .dependency }

Memcached client with built-in compression threshold and level controls.