Skip to main content

A simple implementation of a namespaced memcached client

Project description

Author:

Nicolas Perriault

Contact:
np@akei.com

Abstract

NSMemcached is simple yet efficient Python implementation of a namespaced client for memcached on top of the python-memcached package.

Quick Start

Sample usage:

>>> import memcache
>>> from nsmemcached.client import NamespacedClient
>>> std_client = memcache.Client(['127.0.0.1:11211'])
>>> ns_client = NamespacedClient(std_client)
>>> ns_client.set('foo', 'bar', ns='barspace')
True
>>> ns_client.get('foo', ns='barspace')
bar
>>> ns_client.get('foo')
None
>>> ns_client.clear_ns('barspace')
>>> ns_client.get('foo', ns='barspace')
None

Yes, that simple.

Caveats

Namespace keys are stored in dedicated keys, so every time you request a namespaced item you’ll make two queries to the memcached server instead of one, so expect a tiny slowdown compared to the standard way of using the standard, non-namespaced memcached API.

Dependencies and Compatibility

NSMemcached requires the use of Python 2.4 or more recent.

Installing python-memcached package is required in order to use this library, as well as a working memcached server instance, obviously.

NSMemcached is fully compatible with the API of the standard python-memcached client.

License

This code is released under the terms of the MIT License.

Author

Nicolas Perriault, AKEI, <np at akei dot com>

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

NSMemcached-0.1.0.tar.gz (2.6 kB view details)

Uploaded Source

File details

Details for the file NSMemcached-0.1.0.tar.gz.

File metadata

File hashes

Hashes for NSMemcached-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d3eb04c60a8af2741420af786f5ef0ae84918a560c39aa2f02cbadd0305e5966
MD5 ad4ec978d5dfa434cec8702273884c03
BLAKE2b-256 7906c027f10757eb05eabf5e2e292fe34e42446b76bedd015e107b945a55e9e0

See more details on using hashes here.

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