Skip to main content

Sparta memcached library

Project description

sparta-memcached

Sparta memcached library.

Usage

import pylibmc
import sparta.memcached

alice_cache = sparta.memcached.KeyPrefixWrapper(
    pylibmc.Client(
        ["127.0.0.1:11211"],
        binary=True,
        behaviors={"tcp_nodelay": True, "ketama": True, "no_block": True},
    ),
    key_prefix="alice/",
)

bob_cache = sparta.memcached.KeyPrefixWrapper(
    pylibmc.Client(
        ["127.0.0.1:11211"],
        binary=True,
        behaviors={"tcp_nodelay": True, "ketama": True, "no_block": True},
    ),
    key_prefix="bob/",
)

your_value = ...
alice_cache.set("your_key", your_value)
assert alice_cache.get("your_key") == your_value
assert alice_cache.get("your_key") != bob_cache.get("your_key")

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sparta-memcached-0.0.8.tar.gz (5.1 kB view hashes)

Uploaded Source

Built Distribution

sparta_memcached-0.0.8-py3-none-any.whl (5.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page