fastapi-cachex 0.2.10__tar.gz → 0.2.11__tar.gz
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.
- {fastapi_cachex-0.2.10 → fastapi_cachex-0.2.11}/PKG-INFO +1 -1
- {fastapi_cachex-0.2.10 → fastapi_cachex-0.2.11}/fastapi_cachex/backends/memory.py +9 -1
- {fastapi_cachex-0.2.10 → fastapi_cachex-0.2.11}/fastapi_cachex/backends/redis.py +13 -2
- {fastapi_cachex-0.2.10 → fastapi_cachex-0.2.11}/pyproject.toml +1 -1
- {fastapi_cachex-0.2.10 → fastapi_cachex-0.2.11}/README.md +0 -0
- {fastapi_cachex-0.2.10 → fastapi_cachex-0.2.11}/fastapi_cachex/__init__.py +0 -0
- {fastapi_cachex-0.2.10 → fastapi_cachex-0.2.11}/fastapi_cachex/backends/__init__.py +0 -0
- {fastapi_cachex-0.2.10 → fastapi_cachex-0.2.11}/fastapi_cachex/backends/base.py +0 -0
- {fastapi_cachex-0.2.10 → fastapi_cachex-0.2.11}/fastapi_cachex/backends/config.py +0 -0
- {fastapi_cachex-0.2.10 → fastapi_cachex-0.2.11}/fastapi_cachex/backends/memcached.py +0 -0
- {fastapi_cachex-0.2.10 → fastapi_cachex-0.2.11}/fastapi_cachex/cache.py +0 -0
- {fastapi_cachex-0.2.10 → fastapi_cachex-0.2.11}/fastapi_cachex/dependencies.py +0 -0
- {fastapi_cachex-0.2.10 → fastapi_cachex-0.2.11}/fastapi_cachex/directives.py +0 -0
- {fastapi_cachex-0.2.10 → fastapi_cachex-0.2.11}/fastapi_cachex/exceptions.py +0 -0
- {fastapi_cachex-0.2.10 → fastapi_cachex-0.2.11}/fastapi_cachex/proxy.py +0 -0
- {fastapi_cachex-0.2.10 → fastapi_cachex-0.2.11}/fastapi_cachex/py.typed +0 -0
- {fastapi_cachex-0.2.10 → fastapi_cachex-0.2.11}/fastapi_cachex/routes.py +0 -0
- {fastapi_cachex-0.2.10 → fastapi_cachex-0.2.11}/fastapi_cachex/session/__init__.py +0 -0
- {fastapi_cachex-0.2.10 → fastapi_cachex-0.2.11}/fastapi_cachex/session/config.py +0 -0
- {fastapi_cachex-0.2.10 → fastapi_cachex-0.2.11}/fastapi_cachex/session/dependencies.py +0 -0
- {fastapi_cachex-0.2.10 → fastapi_cachex-0.2.11}/fastapi_cachex/session/exceptions.py +0 -0
- {fastapi_cachex-0.2.10 → fastapi_cachex-0.2.11}/fastapi_cachex/session/manager.py +0 -0
- {fastapi_cachex-0.2.10 → fastapi_cachex-0.2.11}/fastapi_cachex/session/middleware.py +0 -0
- {fastapi_cachex-0.2.10 → fastapi_cachex-0.2.11}/fastapi_cachex/session/models.py +0 -0
- {fastapi_cachex-0.2.10 → fastapi_cachex-0.2.11}/fastapi_cachex/session/proxy.py +0 -0
- {fastapi_cachex-0.2.10 → fastapi_cachex-0.2.11}/fastapi_cachex/session/security.py +0 -0
- {fastapi_cachex-0.2.10 → fastapi_cachex-0.2.11}/fastapi_cachex/session/token_serializers.py +0 -0
- {fastapi_cachex-0.2.10 → fastapi_cachex-0.2.11}/fastapi_cachex/state/__init__.py +0 -0
- {fastapi_cachex-0.2.10 → fastapi_cachex-0.2.11}/fastapi_cachex/state/exceptions.py +0 -0
- {fastapi_cachex-0.2.10 → fastapi_cachex-0.2.11}/fastapi_cachex/state/manager.py +0 -0
- {fastapi_cachex-0.2.10 → fastapi_cachex-0.2.11}/fastapi_cachex/state/models.py +0 -0
- {fastapi_cachex-0.2.10 → fastapi_cachex-0.2.11}/fastapi_cachex/types.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: fastapi-cachex
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.11
|
|
4
4
|
Summary: A caching library for FastAPI with support for Cache-Control, ETag, and multiple backends.
|
|
5
5
|
Keywords: fastapi,cache,etag,cache-control,redis,memcached,in-memory
|
|
6
6
|
Author: allen0099
|
|
@@ -134,10 +134,18 @@ class MemoryBackend(BaseCacheBackend):
|
|
|
134
134
|
parts = key.split(CACHE_KEY_SEPARATOR, _MAX_KEY_PARTS)
|
|
135
135
|
if len(parts) >= _MIN_KEY_PARTS:
|
|
136
136
|
cache_path = parts[2]
|
|
137
|
-
|
|
137
|
+
# A key always has 4 parts (method|||host|||path|||query);
|
|
138
|
+
# an empty query string means no real query params.
|
|
139
|
+
has_params = len(parts) > _MIN_KEY_PARTS and bool(
|
|
140
|
+
parts[_MIN_KEY_PARTS]
|
|
141
|
+
)
|
|
138
142
|
if cache_path == path and (include_params or not has_params):
|
|
139
143
|
keys_to_delete.append(key)
|
|
140
144
|
cleared_count += 1
|
|
145
|
+
elif key == path:
|
|
146
|
+
# Direct key match (custom key format without separators)
|
|
147
|
+
keys_to_delete.append(key)
|
|
148
|
+
cleared_count += 1
|
|
141
149
|
|
|
142
150
|
for key in keys_to_delete:
|
|
143
151
|
del self.cache[key]
|
|
@@ -219,8 +219,13 @@ class AsyncRedisCacheBackend(BaseCacheBackend):
|
|
|
219
219
|
f"{self.key_prefix}*{CACHE_KEY_SEPARATOR}{path}{CACHE_KEY_SEPARATOR}*"
|
|
220
220
|
)
|
|
221
221
|
else:
|
|
222
|
-
# Clear only exact path (no query params): *|||path
|
|
223
|
-
|
|
222
|
+
# Clear only exact path (no query params): *|||path|||
|
|
223
|
+
# The trailing separator is required because default_key_builder
|
|
224
|
+
# always appends a separator after the path (before query_params),
|
|
225
|
+
# so keys with empty query params end with "|||".
|
|
226
|
+
pattern = (
|
|
227
|
+
f"{self.key_prefix}*{CACHE_KEY_SEPARATOR}{path}{CACHE_KEY_SEPARATOR}"
|
|
228
|
+
)
|
|
224
229
|
|
|
225
230
|
cursor = 0
|
|
226
231
|
batch_size = 100
|
|
@@ -239,6 +244,12 @@ class AsyncRedisCacheBackend(BaseCacheBackend):
|
|
|
239
244
|
if cursor == 0:
|
|
240
245
|
break
|
|
241
246
|
|
|
247
|
+
# Also match direct keys (custom key formats without separators)
|
|
248
|
+
# e.g. key_prefix + "gitlab:template" stored directly via backend.set()
|
|
249
|
+
direct_key = self._make_key(path)
|
|
250
|
+
if await self.client.exists(direct_key):
|
|
251
|
+
keys_to_delete.append(direct_key)
|
|
252
|
+
|
|
242
253
|
# Delete all collected keys in batches
|
|
243
254
|
if keys_to_delete:
|
|
244
255
|
for i in range(0, len(keys_to_delete), batch_size):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|