Kekik 1.6.9__py3-none-any.whl → 1.7.0__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.
Potentially problematic release.
This version of Kekik might be problematic. Click here for more details.
- Kekik/cache.py +11 -8
- {Kekik-1.6.9.dist-info → Kekik-1.7.0.dist-info}/METADATA +1 -1
- {Kekik-1.6.9.dist-info → Kekik-1.7.0.dist-info}/RECORD +7 -7
- {Kekik-1.6.9.dist-info → Kekik-1.7.0.dist-info}/LICENSE +0 -0
- {Kekik-1.6.9.dist-info → Kekik-1.7.0.dist-info}/WHEEL +0 -0
- {Kekik-1.6.9.dist-info → Kekik-1.7.0.dist-info}/entry_points.txt +0 -0
- {Kekik-1.6.9.dist-info → Kekik-1.7.0.dist-info}/top_level.txt +0 -0
Kekik/cache.py
CHANGED
|
@@ -75,11 +75,20 @@ class AsyncCache(Cache):
|
|
|
75
75
|
for key in keys:
|
|
76
76
|
self.remove_if_expired(key)
|
|
77
77
|
|
|
78
|
+
def ensure_cleanup_task(self):
|
|
79
|
+
"""Event loop mevcutsa, cleanup task henüz başlatılmadıysa oluştur."""
|
|
80
|
+
if self._cleanup_task is None:
|
|
81
|
+
try:
|
|
82
|
+
self._cleanup_task = asyncio.get_running_loop().create_task(self._auto_cleanup())
|
|
83
|
+
except RuntimeError:
|
|
84
|
+
pass # Yine loop yoksa yapacak bir şey yok
|
|
85
|
+
|
|
78
86
|
async def get(self, key):
|
|
79
87
|
"""
|
|
80
88
|
Belirtilen key için cache'de saklanan değeri asenkron olarak döndürür.
|
|
81
89
|
Eğer key bulunamazsa, ilgili future üzerinden beklemeyi sağlar.
|
|
82
90
|
"""
|
|
91
|
+
self.ensure_cleanup_task()
|
|
83
92
|
self.remove_if_expired(key)
|
|
84
93
|
|
|
85
94
|
try:
|
|
@@ -202,13 +211,11 @@ def kekik_cache(ttl=UNLIMITED, unless=None, is_fastapi=False):
|
|
|
202
211
|
return kekik_cache(UNLIMITED, unless=unless, is_fastapi=is_fastapi)(ttl)
|
|
203
212
|
|
|
204
213
|
def decorator(func):
|
|
214
|
+
func.__cache = AsyncCache(ttl)
|
|
215
|
+
|
|
205
216
|
if asyncio.iscoroutinefunction(func):
|
|
206
217
|
@wraps(func)
|
|
207
218
|
async def async_wrapper(*args, **kwargs):
|
|
208
|
-
# Lazy initialization: İlk çağrıda cache oluşturuluyor
|
|
209
|
-
if not hasattr(func, "__cache"):
|
|
210
|
-
func.__cache = AsyncCache(ttl)
|
|
211
|
-
|
|
212
219
|
key = await make_cache_key(args, kwargs, is_fastapi)
|
|
213
220
|
|
|
214
221
|
try:
|
|
@@ -220,10 +227,6 @@ def kekik_cache(ttl=UNLIMITED, unless=None, is_fastapi=False):
|
|
|
220
227
|
else:
|
|
221
228
|
@wraps(func)
|
|
222
229
|
def sync_wrapper(*args, **kwargs):
|
|
223
|
-
# Lazy initialization: İlk çağrıda cache oluşturuluyor
|
|
224
|
-
if not hasattr(func, "__cache"):
|
|
225
|
-
func.__cache = AsyncCache(ttl)
|
|
226
|
-
|
|
227
230
|
key = (args, tuple(sorted(kwargs.items())))
|
|
228
231
|
|
|
229
232
|
try:
|
|
@@ -2,7 +2,7 @@ Kekik/BIST.py,sha256=gFvEFdLGgsxUq33AkqOr5pVGsSm9jR0v6DVwoSzhX7w,1375
|
|
|
2
2
|
Kekik/Domain2IP.py,sha256=dMDatPElTMfLORzC_QN9znex8Se1eid3EPsxAe5S1aQ,4851
|
|
3
3
|
Kekik/Nesne.py,sha256=33pp49cZkRCoa0aUFfzVMpx5FSJchSdiKhm97Nkol1Q,7020
|
|
4
4
|
Kekik/__init__.py,sha256=Iy-O4c_DuY2ttQJv6j7xoVk3IS9EcC0Aqx3vhFvCgd8,1057
|
|
5
|
-
Kekik/cache.py,sha256=
|
|
5
|
+
Kekik/cache.py,sha256=oLzr1UrzQpeRSjW7MFfJuSRXH3m4aGq98_d_QgoLwfQ,8746
|
|
6
6
|
Kekik/cli.py,sha256=I--MV8-okBSUYAaV4fRsMeB2n57OJITrgbEnK1OdTPY,3648
|
|
7
7
|
Kekik/csv2dict.py,sha256=HO0AgREXE0yM7cL4OwqpkCGm2pz31RTb0mhnTg6gdwo,423
|
|
8
8
|
Kekik/dict2csv.py,sha256=AcGvEg9i5MXtwMwg7WiDxOj8h9LldNjjcRiWFwA9XJU,560
|
|
@@ -34,9 +34,9 @@ Kekik/kisi_ver/__init__.py,sha256=gH613YZC3ziE7f67dViefRSuwDwsHyVvXHpM5CzZ2q4,13
|
|
|
34
34
|
Kekik/kisi_ver/biyografiler.py,sha256=5Xv1ixaDGHGtl5Nf92jo9dPgF3jDXOGEPmWgoEsn9j8,189486
|
|
35
35
|
Kekik/kisi_ver/isimler.py,sha256=zHVimWL_4TvoLE3qzWQslDBc8-IJZSB02s0vRwsVM1g,88066
|
|
36
36
|
Kekik/kisi_ver/soyisimler.py,sha256=YQJYp2SjENgwOaCa9mmShxPYeeUll2cq8Vox-d8_kB8,78485
|
|
37
|
-
Kekik-1.
|
|
38
|
-
Kekik-1.
|
|
39
|
-
Kekik-1.
|
|
40
|
-
Kekik-1.
|
|
41
|
-
Kekik-1.
|
|
42
|
-
Kekik-1.
|
|
37
|
+
Kekik-1.7.0.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
|
38
|
+
Kekik-1.7.0.dist-info/METADATA,sha256=XCZ7g4OpdRavkHS3lGruuViDHz3ktxXHWdwzIq2HhqQ,43959
|
|
39
|
+
Kekik-1.7.0.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
|
40
|
+
Kekik-1.7.0.dist-info/entry_points.txt,sha256=yjBifxtRlqfg8lPkH4Bu-urSa5ecptCHsuth-DcyWcg,59
|
|
41
|
+
Kekik-1.7.0.dist-info/top_level.txt,sha256=NotddscfgxawvuRyAa7xkgnMhyteFDcBxb5aU5GY3BM,6
|
|
42
|
+
Kekik-1.7.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|