Welcome to emcache’s documentation!¶
A high performance asynchronous Python client for Memcached with full batteries included
Installing¶
pip install emcache
Basic Usage¶
Following snippet shows what would be the basic stuff for creating a client, through the emcache.create_client()
factory and how the objected returned can be used
later for performing emcache.Client.get()
and emcache.Client.set()
operations.
Take look to the following sections for understanding what are the different parameters supported by the emcache.create_client()
factory and what commands are
provided by the emcache.Client
object.
import asyncio
import emcache
async def main():
client = await emcache.create_client(
[emcache.MemcachedHostAddress('localhost', 11211)])
await client.set(b'key', b'value')
item = await client.get(b'key')
print(item.value)
await client.close()
asyncio.run(main())
b'value'