mirror of
https://github.com/long2ice/fastapi-cache.git
synced 2026-03-25 13:07:53 +00:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
de1bde39fd | ||
|
|
8490ad36f0 | ||
|
|
57fe4ce24b | ||
|
|
3dc2b53e41 | ||
|
|
2dd37b09ab | ||
|
|
0bc8c6c20e | ||
|
|
9e3c9816c5 |
@@ -2,6 +2,11 @@
|
||||
|
||||
## 0.1
|
||||
|
||||
### 0.1.5
|
||||
|
||||
- Fix setting expire for redis (#24)
|
||||
- Update expire key
|
||||
|
||||
### 0.1.4
|
||||
|
||||
- Fix default expire for memcached. (#13)
|
||||
|
||||
@@ -69,7 +69,7 @@ async def index(request: Request, response: Response):
|
||||
|
||||
@app.on_event("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")
|
||||
|
||||
```
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[tool.poetry]
|
||||
name = "fastapi-cache2"
|
||||
version = "0.1.4"
|
||||
version = "0.1.5"
|
||||
description = "Cache for FastAPI"
|
||||
authors = ["long2ice <long2ice@gmail.com>"]
|
||||
license = "Apache-2.0"
|
||||
|
||||
Reference in New Issue
Block a user