Kekik 1.6.6__py3-none-any.whl → 1.6.8__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 +20 -9
- {Kekik-1.6.6.dist-info → Kekik-1.6.8.dist-info}/METADATA +1 -1
- {Kekik-1.6.6.dist-info → Kekik-1.6.8.dist-info}/RECORD +7 -7
- {Kekik-1.6.6.dist-info → Kekik-1.6.8.dist-info}/LICENSE +0 -0
- {Kekik-1.6.6.dist-info → Kekik-1.6.8.dist-info}/WHEEL +0 -0
- {Kekik-1.6.6.dist-info → Kekik-1.6.8.dist-info}/entry_points.txt +0 -0
- {Kekik-1.6.6.dist-info → Kekik-1.6.8.dist-info}/top_level.txt +0 -0
Kekik/cache.py
CHANGED
|
@@ -132,7 +132,7 @@ async def _async_compute_and_cache(func, key, unless, *args, **kwargs):
|
|
|
132
132
|
|
|
133
133
|
# unless koşuluna göre cache'e ekleme yap.
|
|
134
134
|
if unless is None or not unless(result):
|
|
135
|
-
|
|
135
|
+
cache[key] = result
|
|
136
136
|
|
|
137
137
|
return result
|
|
138
138
|
except Exception as exc:
|
|
@@ -174,17 +174,28 @@ async def make_cache_key(args, kwargs, is_fastapi=False):
|
|
|
174
174
|
def kekik_cache(ttl=UNLIMITED, unless=None, is_fastapi=False):
|
|
175
175
|
"""
|
|
176
176
|
Bir fonksiyon veya coroutine'in sonucunu cache'ler.
|
|
177
|
-
|
|
178
|
-
:param ttl: Cache’in geçerlilik süresi (saniye). UNLIMITED ise süresizdir.
|
|
179
|
-
:param unless: Fonksiyonun sonucunu argüman olarak alan bir callable.
|
|
180
|
-
Eğer True dönerse, sonuç cache'e alınmaz.
|
|
181
|
-
:param is_fastapi: Eğer True ise, cache key'i oluştururken FastAPI request nesnesine özel şekilde davranır.
|
|
182
177
|
|
|
183
|
-
|
|
178
|
+
Args:
|
|
179
|
+
ttl (int, optional): Cache’in geçerlilik süresi (saniye).
|
|
180
|
+
Eğer `UNLIMITED` ise süresizdir. Varsayılan olarak `UNLIMITED`'dir.
|
|
181
|
+
unless (callable, optional): Fonksiyonun sonucunu argüman olarak alan bir callable.
|
|
182
|
+
Eğer `True` dönerse, sonuç cache'e alınmaz. Varsayılan olarak `None`'dır.
|
|
183
|
+
is_fastapi (bool, optional): Eğer `True` ise, cache key'i oluştururken FastAPI request nesnesine özel şekilde davranır.
|
|
184
|
+
Varsayılan olarak `False`'tır.
|
|
185
|
+
|
|
186
|
+
Notlar:
|
|
187
|
+
-------
|
|
188
|
+
Normalde yalnızca Redis cache kullanılmak istenir.
|
|
189
|
+
Ancak Redis'e ulaşılamayan durumlarda RAM fallback kullanılır.
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
Örn.:
|
|
184
194
|
|
|
185
|
-
@kekik_cache(ttl=15, unless=lambda
|
|
195
|
+
@kekik_cache(ttl=15, unless=lambda sonuc: bool(sonuc is None))
|
|
186
196
|
async def bakalim(param):
|
|
187
|
-
|
|
197
|
+
# Burada cache işlemi yapılır.
|
|
198
|
+
return param
|
|
188
199
|
"""
|
|
189
200
|
# Parametresiz kullanıldığında
|
|
190
201
|
if callable(ttl):
|
|
@@ -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=Syl3KGoKXdEVF_205wo6wsFUcI3wKP6Br-UGPBv-7ZA,8343
|
|
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.6.
|
|
38
|
-
Kekik-1.6.
|
|
39
|
-
Kekik-1.6.
|
|
40
|
-
Kekik-1.6.
|
|
41
|
-
Kekik-1.6.
|
|
42
|
-
Kekik-1.6.
|
|
37
|
+
Kekik-1.6.8.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
|
38
|
+
Kekik-1.6.8.dist-info/METADATA,sha256=WnZFVKuuM4KbxhjFrUqEUActYqQKmtfUiGlFTgqzo6A,43959
|
|
39
|
+
Kekik-1.6.8.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
|
40
|
+
Kekik-1.6.8.dist-info/entry_points.txt,sha256=yjBifxtRlqfg8lPkH4Bu-urSa5ecptCHsuth-DcyWcg,59
|
|
41
|
+
Kekik-1.6.8.dist-info/top_level.txt,sha256=NotddscfgxawvuRyAa7xkgnMhyteFDcBxb5aU5GY3BM,6
|
|
42
|
+
Kekik-1.6.8.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|