skillfed

pymemcache

A comprehensive, fast, pure Python memcached client

pymemcache v4.0.0 3.0M downloads/30d#2,802 on PyPI839
Permissive license Apache License 2.0 AGING released

What it is and what it does

pymemcache is a pure-Python client library for memcached that implements the complete memcached text protocol. It provides flexible connection options (TCP over IPv4/IPv6 or UNIX sockets), configurable socket timeouts, and access to memcached's noreply flag for write optimization. The library includes modular serialization and deserialization, optional error-as-cache-miss handling, and supports both single-client and pooled/hashed cluster patterns.

Because it is pure Python with no compiled dependencies, it integrates well with async frameworks like gevent. It is maintained by Pinterest and used in production at scale. The latest version (4.0.0) dropped Python 2 and 3.6 support, added type hints, and introduced pluggable compression serialization.

Use it for:

  • Cache layer for web applications using Django 3.2+ (built-in backend) or other frameworks needing distributed caching.
  • Cluster-aware caching with HashClient for consistent hashing across multiple memcached nodes.
  • Async-compatible caching in gevent-based applications where C extensions are not viable.
  • High-throughput write scenarios using noreply mode to reduce round-trip latency.
  • Custom serialization workflows via flexible serde interface for domain-specific data types.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

A pure-Python memcached client implementing the complete text protocol with support for TCP (IPv4/IPv6) and UNIX sockets, configurable timeouts, and optional noreply mode for faster writes.

Yes, with conditions. Install if you need a pure-Python memcached client for Django 3.2+, gevent integration, or custom serialization. The library is stable and widely used, but maintenance is aging (last release 2022-10-17). Suitable for production use; verify that your Python version is 3.7+ and that you have memcached infrastructure in place.

Install

pymemcache on PyPI

pip

pip install pymemcache

uv

uv add pymemcache

poetry

poetry add pymemcache

Installing pymemcache

Before you install

Low friction: pure Python wheel with no runtime dependencies. Aging maintenance status—last release was 2022-10-17, though the repository remains active with recent commits and no archived status.

License in practice

Apache License 2.0 (permissive) allows commercial use, modification, and distribution with minimal restrictions, making it suitable for most projects.

Quickstart

pip install pymemcache

from pymemcache.client.base import Client

client = Client(('localhost', 'port'))
client.set(b'key', b'value')
result = client.get(b'key')

Requires a running memcached server accessible at the specified host and port.

Verify before relying

  • Current performance characteristics relative to other pure-Python memcached clients in modern workloads.
  • Extent of typing coverage added in version 4.0.0 and whether it covers the full public API.
  • Whether pluggable compression serde (added in 4.0.0) is production-ready and documented.
  • Specific port number or connection defaults for typical memcached deployments.

Package facts

License Apache License 2.0 (permissive)
Python support supports the current Python release (>=3.7)
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance aging — 1,397 days since the last release
Last repo commit
First released
Downloads 2,981,655/month — #2,802 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: pymemcache-4.0.0-py2.py3-none-any.whl

Keywords: memcache, client, database

License :: OSI Approved :: Apache Software LicenseProgramming Language :: PythonProgramming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: PyPyTopic :: Database

Tags

memcached client pythonpure python memcachememcached tcp socketcache client librarymemcached protocol implementationdistributed cache clientmemcached connection pooling
cachingdistributed-systemspure-python

More Database packages