-
-
Save kivsiak/b2fc47008f1cdc01bd4d08359ccfc2d8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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