maleo-foundation 0.3.39__py3-none-any.whl → 0.3.42__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.
- maleo_foundation/models/transfers/general/configurations/cache/redis.py +2 -2
- maleo_foundation/utils/cache.py +17 -4
- {maleo_foundation-0.3.39.dist-info → maleo_foundation-0.3.42.dist-info}/METADATA +1 -1
- {maleo_foundation-0.3.39.dist-info → maleo_foundation-0.3.42.dist-info}/RECORD +6 -6
- {maleo_foundation-0.3.39.dist-info → maleo_foundation-0.3.42.dist-info}/WHEEL +0 -0
- {maleo_foundation-0.3.39.dist-info → maleo_foundation-0.3.42.dist-info}/top_level.txt +0 -0
@@ -9,10 +9,10 @@ class RedisCacheNamespaces(BaseModel):
|
|
9
9
|
def create(
|
10
10
|
self,
|
11
11
|
*ext: str,
|
12
|
-
|
12
|
+
layer: BaseEnums.CacheLayer,
|
13
13
|
base_override: BaseTypes.OptionalString = None
|
14
14
|
) -> str:
|
15
|
-
return ":".join([self.base if base_override is None else base_override,
|
15
|
+
return ":".join([self.base if base_override is None else base_override, layer, *ext])
|
16
16
|
|
17
17
|
class RedisCacheConfigurations(BaseModel):
|
18
18
|
ttl: Union[int, float] = Field(BaseEnums.Expiration.EXP_5MN, description="Default TTL")
|
maleo_foundation/utils/cache.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
import json
|
2
|
-
from typing import Callable
|
3
2
|
from fastapi.encoders import jsonable_encoder
|
3
|
+
from pydantic import BaseModel
|
4
|
+
from typing import Callable
|
4
5
|
|
5
6
|
def key_builder(
|
6
7
|
func: Callable,
|
@@ -10,18 +11,30 @@ def key_builder(
|
|
10
11
|
arg_values = []
|
11
12
|
for arg in args:
|
12
13
|
try:
|
13
|
-
|
14
|
+
if isinstance(arg, BaseModel) and hasattr(arg, "model_dump"):
|
15
|
+
arg_values.append(arg.model_dump(mode="json"))
|
16
|
+
else:
|
17
|
+
arg_values.append(jsonable_encoder(arg))
|
14
18
|
except Exception:
|
15
19
|
arg_values.append(str(arg))
|
16
20
|
|
17
21
|
kwarg_values = {}
|
18
22
|
for k, v in kwargs.items():
|
19
23
|
try:
|
20
|
-
|
24
|
+
if isinstance(v, BaseModel) and hasattr(arg, "model_dump"):
|
25
|
+
kwarg_values[k] = v.model_dump(mode="json")
|
26
|
+
else:
|
27
|
+
kwarg_values[k] = jsonable_encoder(v)
|
21
28
|
except Exception:
|
22
29
|
kwarg_values[k] = str(v)
|
23
30
|
|
24
31
|
serialized_args = json.dumps(arg_values, sort_keys=True)
|
25
32
|
serialized_kwargs = json.dumps(kwarg_values, sort_keys=True)
|
26
33
|
|
27
|
-
return f"{func.__module__}:{func.__qualname__}({serialized_args}|{serialized_kwargs})"
|
34
|
+
return f"{func.__module__}:{func.__qualname__}({serialized_args}|{serialized_kwargs})"
|
35
|
+
|
36
|
+
def build_key(
|
37
|
+
namespace: str,
|
38
|
+
*ext: str
|
39
|
+
):
|
40
|
+
return ":".join([namespace, *ext])
|
@@ -76,7 +76,7 @@ maleo_foundation/models/transfers/general/configurations/database.py,sha256=v-Iz
|
|
76
76
|
maleo_foundation/models/transfers/general/configurations/middleware.py,sha256=-6dk6C2QBDfmTDENhsgyMHpRUGfrSxQY3BDwo_WtgAs,1710
|
77
77
|
maleo_foundation/models/transfers/general/configurations/service.py,sha256=8lag1KXkS43IwsMGWka7L-peQ9YT1-dmWeEhQ1hnnLU,304
|
78
78
|
maleo_foundation/models/transfers/general/configurations/cache/__init__.py,sha256=a7p5LWkQJlgcfKpdJrKnCfe1LUAnwltXwTOThANlR6s,286
|
79
|
-
maleo_foundation/models/transfers/general/configurations/cache/redis.py,sha256=
|
79
|
+
maleo_foundation/models/transfers/general/configurations/cache/redis.py,sha256=bKh5UH2Nm5pyQ4XiUiGUymrBuwInegO4i45Un3z24AQ,1166
|
80
80
|
maleo_foundation/models/transfers/general/configurations/client/__init__.py,sha256=2Iln1K23ad283y_PxVf4Zo25LZrGlrIIYlqm0cCFO5U,331
|
81
81
|
maleo_foundation/models/transfers/general/configurations/client/maleo.py,sha256=0ecfHUW-gkmUZBrCINdoFJN9t03VGV9a8ND1D-LpmNc,1741
|
82
82
|
maleo_foundation/models/transfers/parameters/__init__.py,sha256=oKW4RPIEISISRjsJzD8lsCGY1HhZRTzshPpWHcJu86k,353
|
@@ -111,7 +111,7 @@ maleo_foundation/models/transfers/results/service/repository.py,sha256=djITRZh2j
|
|
111
111
|
maleo_foundation/models/transfers/results/service/controllers/__init__.py,sha256=HZJWMy2dskzOCzLmp_UaL9rjbQ-sDMI7sd2bXb-4QOU,175
|
112
112
|
maleo_foundation/models/transfers/results/service/controllers/rest.py,sha256=txZG-yFttHTla8-m85taLt8lrt-n3NeYVvRPGQnGm4M,1124
|
113
113
|
maleo_foundation/utils/__init__.py,sha256=ZZv0NDcTdHsHl51EKfgrlCm8CQmgvyIndMcQABDudN0,391
|
114
|
-
maleo_foundation/utils/cache.py,sha256=
|
114
|
+
maleo_foundation/utils/cache.py,sha256=G0ywe0kSxWaoUm_bn2cPBGqVTx9rSYzveEkFJ2tZg4k,1170
|
115
115
|
maleo_foundation/utils/client.py,sha256=CGwn8eH5WlwnE5tPMfMAH5V3BItBgVmYBZnXpLjTVSc,2826
|
116
116
|
maleo_foundation/utils/controller.py,sha256=Ub1R-JN6spmXakYrOY7igwaNt4Sg8LASASdXymxZcCI,6954
|
117
117
|
maleo_foundation/utils/exceptions.py,sha256=z24kzEP2geaAEElxXaEy7ln6KodebXvtlu-h1inZ_nw,6376
|
@@ -133,7 +133,7 @@ maleo_foundation/utils/loaders/credential/__init__.py,sha256=qopTKvcMVoTFwyRijeg
|
|
133
133
|
maleo_foundation/utils/loaders/credential/google.py,sha256=ZglnLdW3lHmaKER4mwGe5N5ERus-bdsamfpwGmQYPIo,6344
|
134
134
|
maleo_foundation/utils/loaders/key/__init__.py,sha256=hVygcC2ImHc_aVrSrOmyedR8tMUZokWUKCKOSh5ctbo,106
|
135
135
|
maleo_foundation/utils/loaders/key/rsa.py,sha256=gDhyX6iTFtHiluuhFCozaZ3pOLKU2Y9TlrNMK_GVyGU,3796
|
136
|
-
maleo_foundation-0.3.
|
137
|
-
maleo_foundation-0.3.
|
138
|
-
maleo_foundation-0.3.
|
139
|
-
maleo_foundation-0.3.
|
136
|
+
maleo_foundation-0.3.42.dist-info/METADATA,sha256=7SRB2HR-ynhHw7kRbjFqEFnU-OmXnlDSkyn-4teZq1I,3740
|
137
|
+
maleo_foundation-0.3.42.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
138
|
+
maleo_foundation-0.3.42.dist-info/top_level.txt,sha256=_iBos3F_bhEOdjOnzeiEYSrCucasc810xXtLBXI8cQc,17
|
139
|
+
maleo_foundation-0.3.42.dist-info/RECORD,,
|
File without changes
|
File without changes
|