Skip to content

Instantly share code, notes, and snippets.

@kivsiak

kivsiak/test.py Secret

Created October 31, 2017 07:12
Show Gist options
  • Save kivsiak/b2fc47008f1cdc01bd4d08359ccfc2d8 to your computer and use it in GitHub Desktop.
Save kivsiak/b2fc47008f1cdc01bd4d08359ccfc2d8 to your computer and use it in GitHub Desktop.
import asyncio
from aiocache import cached, RedisCache
from aiocache.serializers import PickleSerializer
@cached(ttl=10, cache=RedisCache, key="text", serializer=PickleSerializer(), port=6379, namespace="main")
async def cached_call():
return "xxx"
async def call():
await cached_call()
await cached_call.close()
def test_cached():
loop = asyncio.get_event_loop()
loop.run_until_complete(call())
if __name__ == "__main__":
test_cached()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment