aiomcache is a minimal pure Python memcached client built for asynchronous applications with `asyncio`. It provides an easy-to-use interface for common memcached operations like set, get, and delete. The current version is 0.8.2, and it is actively maintained within the `aio-libs` project with a moderate release cadence addressing bug fixes and minor features.
pip install aiomcacheVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to initialize `aiomcache.Client`, set, get, and delete data asynchronously. It uses environment variables for host and port, falling back to localhost:11211, and includes error handling and graceful client closure.
Upgrade your Python environment to 3.4 or higher. The current version (0.8.2) requires Python >= 3.8.
Review code that uses `Client.get()` in versions < 0.8.0. If CAS-like behavior is required, explicitly use `Client.gets()` (available since v0.5.0) for versions >= 0.8.0.
Upgrade to aiomcache v0.5.2 or newer to benefit from the fix for pool concurrency issues. This ensures more robust connection handling in high-concurrency environments.
Ensure a memcached server is running and reachable on the specified `host` and `port`. Verify firewall rules or container network settings if applicable. Check the memcached server logs for issues.
Initialize the client directly without `await`: `mc = Client(host, port)`. Then, `await` its methods like `await mc.set(...)` or `await mc.get(...)`.
Always check if the result of `Client.get()` is not `None` before attempting to decode, parse, or otherwise use it. Example: `value = await mc.get(key); if value is not None: ...`
No dependency data recorded yet.