Skip to content

Instantly share code, notes, and snippets.

@kristoff-it
Created September 18, 2019 13:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kristoff-it/97decafe70b1644948bb73db1cd9f94d to your computer and use it in GitHub Desktop.
Save kristoff-it/97decafe70b1644948bb73db1cd9f94d to your computer and use it in GitHub Desktop.
import asyncio, aioredis
async def main():
pool = await aioredis.create_redis_pool('localhost',
db=0, password=None, ssl=False, minsize=4, maxsize=10, encoding='utf8')
# No need to pluck a single connection
# aioredis will schedule your command to
# a random connection inside the pool.
await pool.set("key", "hello world")
await pool.incrby("counter", 3)
if __name__ == '__main__':
loop = asyncio.main_loop()
loop.run_until_complete(main())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment