fast-cache-middleware 0.0.3__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/middleware.py +1 -13
- {fast_cache_middleware-0.0.3.dist-info → fast_cache_middleware-0.0.4.dist-info}/METADATA +3 -5
- {fast_cache_middleware-0.0.3.dist-info → fast_cache_middleware-0.0.4.dist-info}/RECORD +4 -4
- {fast_cache_middleware-0.0.3.dist-info → fast_cache_middleware-0.0.4.dist-info}/WHEEL +0 -0
@@ -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
|
@@ -112,12 +110,6 @@ async def send_with_callbacks(
|
|
112
110
|
await app(scope, receive, response_builder)
|
113
111
|
|
114
112
|
|
115
|
-
def _build_scope_hash_key(scope: Scope) -> str:
|
116
|
-
path = get_route_path(scope)
|
117
|
-
method = scope["method"].upper()
|
118
|
-
return f"{path}/{method}"
|
119
|
-
|
120
|
-
|
121
113
|
class FastCacheMiddleware:
|
122
114
|
"""Middleware for caching responses in ASGI applications.
|
123
115
|
|
@@ -205,10 +197,6 @@ class FastCacheMiddleware:
|
|
205
197
|
|
206
198
|
return cache_config, cache_drop_config
|
207
199
|
|
208
|
-
@cachetools.cached(
|
209
|
-
cache=cachetools.LRUCache(maxsize=10**3),
|
210
|
-
key=lambda _, request, __: _build_scope_hash_key(request.scope),
|
211
|
-
)
|
212
200
|
def _find_matching_route(
|
213
201
|
self, request: Request, routes_info: list[RouteInfo]
|
214
202
|
) -> tp.Optional[RouteInfo]:
|
@@ -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
|
|
@@ -2,10 +2,10 @@ fast_cache_middleware/__init__.py,sha256=0wuBPKrzjyBA2K9Fnm-xzC1mYSXCMuYr1uPutNX
|
|
2
2
|
fast_cache_middleware/controller.py,sha256=Y0StElopHiBHa-TjLqi1yoldWkcGZubcCgT2xj2zpEI,7181
|
3
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
|