Python async client for Memcached
Project description
memcachio
A pure python async Memcached client with 0 dependencies with support for:
- All memcached commands
- Memcached servers serving on TCP or Unix Domain Sockets
- Memcached clusters
- SSL transport
- SASL Authentication
- Connection reuse for multiple concurrent requests
- Dynamically adjusted connection pooling
- Auto discovery with AWS ElastiCache
Installation
To install memcachio:
$ pip install memcachio
Quick start
Single Node or Cluster client
import asyncio
from memcachio import Client
async def example() -> None:
#: basic client
raw_client = Client(("localhost", 11211))
#: client that decodes the byte responses
decoding_client = Client(("localhost", 11211), decode_responses=True)
# or with a cluster
# cluster_client = Client([("localhost", 11211), ("localhost", 11212)], decode_responses=True)
await raw_client.flushall()
await raw_client.set("foo", b"1")
await raw_client.set("bar", b"2")
assert 2 == await raw_client.incr("foo", 1)
# use the raw client to get a value.
# Note the mapping returned has byte keys
assert (await raw_client.get("foo")).get(b"foo").value == b"2"
# get the values with the decoding client and touch their expiry to be 1 second.
# Note the mapping and the values are strings.
gat_and_touch_many = await decoding_client.gat("foo", "bar", expiry=1)
assert ["2", "2"] == [item.value for item in gat_and_touch_many.values()]
await asyncio.sleep(1)
assert {} == await decoding_client.get("foo", "bar")
asyncio.run(example())
See Client for detailed descriptions of available options when constructing a client.
Compatibility
memcachio is tested against memcached versions 1.6.x
Supported python versions
- 3.10
- 3.11
- 3.12
- 3.13
- PyPy 3.10
- PyPy 3.11
References
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file memcachio-0.4.0.tar.gz.
File metadata
- Download URL: memcachio-0.4.0.tar.gz
- Upload date:
- Size: 45.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
27a8b1752b7c39b9625279832b81cf2bb14a4c2bed2c138c731648b5102cbcbf
|
|
| MD5 |
03b6bd842454a2f733003c7d47b046e9
|
|
| BLAKE2b-256 |
b5f02d2ac9681ef50bcc7444b231e82564f3481512ee15421b2ee796863917bf
|
Provenance
The following attestation bundles were made for memcachio-0.4.0.tar.gz:
Publisher:
main.yml on alisaifee/memcachio
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
memcachio-0.4.0.tar.gz -
Subject digest:
27a8b1752b7c39b9625279832b81cf2bb14a4c2bed2c138c731648b5102cbcbf - Sigstore transparency entry: 198378663
- Sigstore integration time:
-
Permalink:
alisaifee/memcachio@2979be17c974f49f53e912550bc973c75149bbdb -
Branch / Tag:
refs/tags/0.4.0 - Owner: https://github.com/alisaifee
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
main.yml@2979be17c974f49f53e912550bc973c75149bbdb -
Trigger Event:
push
-
Statement type:
File details
Details for the file memcachio-0.4.0-py3-none-any.whl.
File metadata
- Download URL: memcachio-0.4.0-py3-none-any.whl
- Upload date:
- Size: 28.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3a3acf78a764931ef532953fd1e7ae4a200d74f59fc65ea8dc73834504256338
|
|
| MD5 |
390709476bd17809872109d68d930b8e
|
|
| BLAKE2b-256 |
c7402315a4f6e1197fdbfb1da4e28418d70de692f8582d6bdbf54c73722b238f
|
Provenance
The following attestation bundles were made for memcachio-0.4.0-py3-none-any.whl:
Publisher:
main.yml on alisaifee/memcachio
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
memcachio-0.4.0-py3-none-any.whl -
Subject digest:
3a3acf78a764931ef532953fd1e7ae4a200d74f59fc65ea8dc73834504256338 - Sigstore transparency entry: 198378664
- Sigstore integration time:
-
Permalink:
alisaifee/memcachio@2979be17c974f49f53e912550bc973c75149bbdb -
Branch / Tag:
refs/tags/0.4.0 - Owner: https://github.com/alisaifee
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
main.yml@2979be17c974f49f53e912550bc973c75149bbdb -
Trigger Event:
push
-
Statement type: