fast-cache-middleware 0.0.2__py3-none-any.whl → 0.0.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- fast_cache_middleware/depends.py +1 -1
- fast_cache_middleware/middleware.py +3 -7
- {fast_cache_middleware-0.0.2.dist-info → fast_cache_middleware-0.0.4.dist-info}/METADATA +3 -5
- {fast_cache_middleware-0.0.2.dist-info → fast_cache_middleware-0.0.4.dist-info}/RECORD +5 -5
- {fast_cache_middleware-0.0.2.dist-info → fast_cache_middleware-0.0.4.dist-info}/WHEEL +0 -0
fast_cache_middleware/depends.py
CHANGED
@@ -62,5 +62,5 @@ class CacheDropConfig(BaseCacheConfigDepends):
|
|
62
62
|
|
63
63
|
def __init__(self, paths: list[str | re.Pattern]) -> None:
|
64
64
|
self.paths: list[re.Pattern] = [
|
65
|
-
p if isinstance(p, re.Pattern) else re.compile(f"^{p}
|
65
|
+
p if isinstance(p, re.Pattern) else re.compile(f"^{p}") for p in paths
|
66
66
|
]
|
@@ -1,13 +1,11 @@
|
|
1
1
|
import copy
|
2
|
-
import inspect
|
3
2
|
import logging
|
4
3
|
import typing as tp
|
5
|
-
import cachetools
|
6
4
|
|
7
5
|
from fastapi import FastAPI, routing
|
8
6
|
from starlette.requests import Request
|
9
7
|
from starlette.responses import Response
|
10
|
-
from starlette.routing import Mount
|
8
|
+
from starlette.routing import Mount
|
11
9
|
from starlette.types import ASGIApp, Receive, Scope, Send
|
12
10
|
|
13
11
|
from .controller import Controller
|
@@ -199,10 +197,6 @@ class FastCacheMiddleware:
|
|
199
197
|
|
200
198
|
return cache_config, cache_drop_config
|
201
199
|
|
202
|
-
@cachetools.cached(
|
203
|
-
cache=cachetools.LRUCache(maxsize=10**3),
|
204
|
-
key=lambda _, request, __: get_route_path(request.scope),
|
205
|
-
)
|
206
200
|
def _find_matching_route(
|
207
201
|
self, request: Request, routes_info: list[RouteInfo]
|
208
202
|
) -> tp.Optional[RouteInfo]:
|
@@ -215,6 +209,8 @@ class FastCacheMiddleware:
|
|
215
209
|
RouteInfo if matching route found, otherwise None
|
216
210
|
"""
|
217
211
|
for route_info in routes_info:
|
212
|
+
if request.method not in route_info.methods:
|
213
|
+
continue
|
218
214
|
match_mode, _ = route_info.route.matches(request.scope)
|
219
215
|
if match_mode == routing.Match.FULL:
|
220
216
|
return route_info
|
@@ -1,17 +1,15 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: fast-cache-middleware
|
3
|
-
Version: 0.0.
|
4
|
-
Summary:
|
3
|
+
Version: 0.0.4
|
4
|
+
Summary: An intelligent middleware for caching FastAPI responses
|
5
5
|
License: MIT
|
6
|
-
Author:
|
7
|
-
Author-email: your.email@example.com
|
6
|
+
Author: www.chud0@gmail.com
|
8
7
|
Requires-Python: >=3.11,<4.0
|
9
8
|
Classifier: License :: OSI Approved :: MIT License
|
10
9
|
Classifier: Programming Language :: Python :: 3
|
11
10
|
Classifier: Programming Language :: Python :: 3.11
|
12
11
|
Classifier: Programming Language :: Python :: 3.12
|
13
12
|
Classifier: Programming Language :: Python :: 3.13
|
14
|
-
Requires-Dist: cachetools (>=5.0.0,<7.0.0)
|
15
13
|
Requires-Dist: fastapi (>=0.111.1,<1.0.0)
|
16
14
|
Description-Content-Type: text/markdown
|
17
15
|
|
@@ -1,11 +1,11 @@
|
|
1
1
|
fast_cache_middleware/__init__.py,sha256=0wuBPKrzjyBA2K9Fnm-xzC1mYSXCMuYr1uPutNXCI5Y,983
|
2
2
|
fast_cache_middleware/controller.py,sha256=Y0StElopHiBHa-TjLqi1yoldWkcGZubcCgT2xj2zpEI,7181
|
3
|
-
fast_cache_middleware/depends.py,sha256=
|
3
|
+
fast_cache_middleware/depends.py,sha256=00ShPXlG0A_Ylj0ypLGU0hgSNeLxHeI3PGi8Fo35wko,1867
|
4
4
|
fast_cache_middleware/exceptions.py,sha256=lv3p2-wAj6UZI7czVSy91eZtuXItr1hZHW2LDz8fI9s,109
|
5
|
-
fast_cache_middleware/middleware.py,sha256=
|
5
|
+
fast_cache_middleware/middleware.py,sha256=847_B5oj-zCZef9PvS57gBvM7t4xs1kOsmRqMd_3yCI,9409
|
6
6
|
fast_cache_middleware/schemas.py,sha256=uOceBR4_itlj1NG3xszyLbE96bS_W6t6BGmPPkNkoqA,610
|
7
7
|
fast_cache_middleware/serializers.py,sha256=jf308cez8jVzTikK6BhzHhvuIrGkA8Vdn_Gopd6dfyM,2907
|
8
8
|
fast_cache_middleware/storages.py,sha256=GEeA-I0QvK6M_mAub08npxylLQ_WEBGyrjt9Zhe_r6A,7611
|
9
|
-
fast_cache_middleware-0.0.
|
10
|
-
fast_cache_middleware-0.0.
|
11
|
-
fast_cache_middleware-0.0.
|
9
|
+
fast_cache_middleware-0.0.4.dist-info/METADATA,sha256=2Z2VyDcBBCahn8GXhcGKKJqKiIvRZm-9C1stt8q1UOY,13593
|
10
|
+
fast_cache_middleware-0.0.4.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
11
|
+
fast_cache_middleware-0.0.4.dist-info/RECORD,,
|
File without changes
|