7 Commits

Author SHA1 Message Date
long2ice
de1bde39fd update version 2021-07-23 09:38:47 +08:00
long2ice
8490ad36f0 Merge pull request #25 from dveleztx/master
This fixes #24.
2021-07-23 09:38:04 +08:00
David Velez
57fe4ce24b Updated changelog to 1.4 from 1.5 2021-07-22 10:54:10 -05:00
David Velez
3dc2b53e41 Updated changelog and version for the project. 2021-07-22 10:47:02 -05:00
David Velez
2dd37b09ab 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. 2021-07-22 10:17:52 -05:00
long2ice
0bc8c6c20e Merge pull request #22 from heliumbrain/master
Adapt to aioredis 2.0
2021-07-16 10:02:10 +08:00
heliumbrain
9e3c9816c5 Update README.md
Updated readme to reflect the changes in aioredis 2.0
2021-07-15 23:15:01 +02:00
4 changed files with 8 additions and 3 deletions

View File

@@ -2,6 +2,11 @@
## 0.1 ## 0.1
### 0.1.5
- Fix setting expire for redis (#24)
- Update expire key
### 0.1.4 ### 0.1.4
- Fix default expire for memcached. (#13) - Fix default expire for memcached. (#13)

View File

@@ -69,7 +69,7 @@ async def index(request: Request, response: Response):
@app.on_event("startup") @app.on_event("startup")
async def startup(): async def startup():
redis = await aioredis.create_redis_pool("redis://localhost", encoding="utf8") redis = aioredis.from_url("redis://localhost", encoding="utf8", decode_responses=True)
FastAPICache.init(RedisBackend(redis), prefix="fastapi-cache") FastAPICache.init(RedisBackend(redis), prefix="fastapi-cache")
``` ```

View File

@@ -19,7 +19,7 @@ class RedisBackend(Backend):
return await self.redis.get(key) return await self.redis.get(key)
async def set(self, key: str, value: str, expire: int = None): 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: async def clear(self, namespace: str = None, key: str = None) -> int:
if namespace: if namespace:

View File

@@ -1,6 +1,6 @@
[tool.poetry] [tool.poetry]
name = "fastapi-cache2" name = "fastapi-cache2"
version = "0.1.4" version = "0.1.5"
description = "Cache for FastAPI" description = "Cache for FastAPI"
authors = ["long2ice <long2ice@gmail.com>"] authors = ["long2ice <long2ice@gmail.com>"]
license = "Apache-2.0" license = "Apache-2.0"