From 2dd37b09ab99a344bc0017fdef8818238c90d5ec Mon Sep 17 00:00:00 2001 From: David Velez Date: Thu, 22 Jul 2021 10:17:52 -0500 Subject: [PATCH] This fixes #24. Looking at aioredis library, the client.py keyword for set is now 'ex', not 'expire'. Tested this fix and fast-cache now works without issue. --- fastapi_cache/backends/redis.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fastapi_cache/backends/redis.py b/fastapi_cache/backends/redis.py index be67d3f..c82cdd9 100644 --- a/fastapi_cache/backends/redis.py +++ b/fastapi_cache/backends/redis.py @@ -19,7 +19,7 @@ class RedisBackend(Backend): return await self.redis.get(key) async def set(self, key: str, value: str, expire: int = None): - return await self.redis.set(key, value, expire=expire) + return await self.redis.set(key, value, ex=expire) async def clear(self, namespace: str = None, key: str = None) -> int: if namespace: