From 59a47b7faec895b56dfd6f3d75a286d539dc3cd6 Mon Sep 17 00:00:00 2001 From: long2ice Date: Wed, 11 Jan 2023 21:20:41 +0800 Subject: [PATCH] chore: set version 0.2.0 --- CHANGELOG.md | 9 +++------ examples/in_memory/main.py | 2 +- examples/redis/main.py | 3 +-- fastapi_cache/decorator.py | 4 +++- pyproject.toml | 4 ++-- 5 files changed, 10 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 49a047f..f52d7f8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,8 +2,10 @@ ## 0.2 -### 0.2.1 +### 0.2.0 +- Make `request` and `response` optional. +- Add typing info to the `cache` decorator. - Support cache jinja2 template response. - Support cache `JSONResponse` - Add `py.typed` file and type hints @@ -11,11 +13,6 @@ - Fix cache decorate sync function - Transparently handle backend connection failures. -### 0.2.0 - -- Make `request` and `response` optional. -- Add typing info to the `cache` decorator. - ## 0.1 ### 0.1.10 diff --git a/examples/in_memory/main.py b/examples/in_memory/main.py index 471899e..68b6e17 100644 --- a/examples/in_memory/main.py +++ b/examples/in_memory/main.py @@ -2,7 +2,7 @@ import pendulum import uvicorn from fastapi import FastAPI from starlette.requests import Request -from starlette.responses import Response, JSONResponse +from starlette.responses import JSONResponse, Response from fastapi_cache import FastAPICache from fastapi_cache.backends.inmemory import InMemoryBackend diff --git a/examples/redis/main.py b/examples/redis/main.py index 19a272a..e05eda5 100644 --- a/examples/redis/main.py +++ b/examples/redis/main.py @@ -4,13 +4,12 @@ import pendulum import redis.asyncio as redis import uvicorn from fastapi import FastAPI -from starlette.responses import JSONResponse from fastapi.responses import HTMLResponse from fastapi.staticfiles import StaticFiles from fastapi.templating import Jinja2Templates from redis.asyncio.connection import ConnectionPool from starlette.requests import Request -from starlette.responses import Response +from starlette.responses import JSONResponse, Response from fastapi_cache import FastAPICache from fastapi_cache.backends.redis import RedisBackend diff --git a/fastapi_cache/decorator.py b/fastapi_cache/decorator.py index bcfe9b5..5018b1e 100644 --- a/fastapi_cache/decorator.py +++ b/fastapi_cache/decorator.py @@ -132,7 +132,9 @@ def cache( return coder.decode(ret) ret = await ensure_async_func(*args, **kwargs) try: - await backend.set(cache_key, coder.encode(ret), expire or FastAPICache.get_expire()) + await backend.set( + cache_key, coder.encode(ret), expire or FastAPICache.get_expire() + ) except ConnectionError: pass return ret diff --git a/pyproject.toml b/pyproject.toml index 36998f7..292d273 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "fastapi-cache2" -version = "0.2.1" +version = "0.2.0" description = "Cache for FastAPI" authors = ["long2ice "] license = "Apache-2.0" @@ -23,7 +23,7 @@ aiomcache = { version = "*", optional = true } pendulum = "*" aiobotocore = { version = "^1.4.1", optional = true } typing-extensions = { version = ">=4.1.0", markers = "python_version < \"3.10\"" } -aiohttp= { version = ">=3.8.3", markers = "python_version >= \"3.11\""} +aiohttp = { version = ">=3.8.3", markers = "python_version >= \"3.11\"" } [tool.poetry.dev-dependencies] flake8 = "*"