Skip to main content

Python module using memcache as a lock server.

Disclaimer: This code is inspired by unimr.memcachedlock . I thought I could write a simpler version of MemcachedRLock class to keep dependencies minimal (python builtins plus python-memcache), and enforcing support of gets/cas API.

WARNING: little testing has been done so far. Better review & stress this code before using it anywhere for the moment.

Example usage: import memcachelock import memcache # python-memcached doesn’t do cas correctly without cache_cas mc = memcache.Client([‘127.0.0.1:11211’], cache_cas=True) # Non-reentrant lock mclock = memcachelock.Lock(mc, ‘foo_resource’) # Per-connection reentrant lock mcrlock = memcachelock.RLock(mc, ‘foo_resource’) # Per-connection and per-thread reentrant lock rmcrlock = memcachelock.ThreadRLock(mc, ‘foo_resource’)

All lock instances have the same API as thread.LockType (as of python 2.7). ‘foo_resource’ is any string usable as a memcache key identifying some resource this lock protects. In Zope world, it might be a traversable object’s path, or a database identifier plus some database-scoped unique identifier…

Release files for memcachelock 0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for memcachelock 0.4
File Size Uploaded
memcachelock-0.4.tar.gz 6.2 kB Details

Release files / memcachelock-0.4.tar.gz

Download URL memcachelock-0.4.tar.gz
Size 6.2 kB
Tags Source
SHA-256 checksum
How to use checksums
3996a418c9ab115779bb59e53c82cb3a822d5d1726002014404d030b93bfa419
BLAKE2b-256 checksum
How to use checksums
1c79f5b92afd41ef9ef6f71e0ade6829c2f6dcf847276f6dc4566b123c672c89
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.4 This release

1 release file

0.3.1

1 release file

0.3

1 release file

0.2

1 release file

0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page