Welcome to asyncredis’s documentation!¶
Getting Started¶
Getting started with asyncredis
is super easy! Here’s some boiler-plate code to get you started!
import asyncio
import asyncredis
async def main():
redis = await asyncredis.connect("redis://localhost:6345") # connect to your redis server
await redis.set("hello", "world") # set a key called "hello" with a value of "world"
value = await redis.get("hello") # retrieve the same key back from the database
print(value)
await redis.close() # close and terminate the connection
loop = asyncio.get_event_loop()
loop.run_until_complete(main())
>>> world