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

Conditional Cache Journal

A helper that relies on memcached's conditional write and string concatenation primitives to manage text entries without race-prone read-modify-write cycles.

Capabilities

Initialize entry only when absent

  • Starting the journal with seed text stores it only if the key is missing and returns True; calling it again leaves the existing value untouched and returns False. @test

Replace only when present

  • Overwriting with new text succeeds only when the key already exists and returns True; attempting on a missing key returns False without creating the entry. @test

Append message

  • Appending "second" to an existing entry "first" results in "first\nsecond" through a direct concatenation primitive rather than fetching and rewriting the value. @test

Prepend banner

  • Prepending "[HDR]" to an existing entry "body" results in "[HDR]body" while leaving the remainder intact. @test

Implementation

@generates

API

from typing import Any

class CacheJournal:
    def __init__(self, client: Any, default_ttl: int | None = None):
        ...

    def initialize(self, key: str, seed: str, ttl: int | None = None) -> bool:
        ...

    def overwrite_existing(self, key: str, text: str, ttl: int | None = None) -> bool:
        ...

    def append_entry(self, key: str, text: str) -> bool:
        ...

    def prepend_banner(self, key: str, banner: str) -> bool:
        ...

Dependencies { .dependencies }

pylibmc { .dependency }

Memcached client providing conditional writes and in-place string concatenation.