miolo 3.0.0-beta.196 → 3.0.0-beta.197
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.
package/package.json
CHANGED
|
@@ -1,35 +1,48 @@
|
|
|
1
1
|
import { cacheiro } from "cacheiro"
|
|
2
|
-
import { miolo_cacher_options_for_custom } from "./options.mjs"
|
|
2
|
+
import { miolo_cacher_options_for_custom, miolo_cacher_options_for_default } from "./options.mjs"
|
|
3
3
|
|
|
4
|
-
let
|
|
4
|
+
let _glob_cache_mother
|
|
5
|
+
|
|
6
|
+
const _get_cache_mother = async (config, logger) => {
|
|
7
|
+
if (_glob_cache_mother === undefined) {
|
|
8
|
+
const default_options = miolo_cacher_options_for_default(config, logger)
|
|
9
|
+
_glob_cache_mother = await cacheiro({
|
|
10
|
+
...default_options,
|
|
11
|
+
namespace: "miolo-cache-stores"
|
|
12
|
+
})
|
|
13
|
+
}
|
|
14
|
+
return _glob_cache_mother
|
|
15
|
+
}
|
|
5
16
|
|
|
6
17
|
export function init_context_cache(config, logger) {
|
|
7
18
|
const custom_options = miolo_cacher_options_for_custom(config, logger)
|
|
8
19
|
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
20
|
+
const _init_cache_instance = async (name) => {
|
|
21
|
+
const cache_mother = await _get_cache_mother(config, logger)
|
|
22
|
+
|
|
23
|
+
const cache_instance = await cacheiro(custom_options?.[name] || {})
|
|
24
|
+
await cache_mother.setItem(name, cache_instance)
|
|
25
|
+
return cache_instance
|
|
13
26
|
}
|
|
14
27
|
|
|
15
28
|
const init = async () => {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
for (const name of Object.keys(custom_options)) {
|
|
19
|
-
_glob_cache_stores[name] = await _init_cache(name)
|
|
20
|
-
}
|
|
29
|
+
await _get_cache_mother(config, logger)
|
|
21
30
|
}
|
|
22
31
|
|
|
23
32
|
const get_cache = async (name) => {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
33
|
+
const cache_mother = await _get_cache_mother(config, logger)
|
|
34
|
+
|
|
35
|
+
let cache_instance = await cache_mother.getItem(name)
|
|
36
|
+
if (cache_instance === undefined) {
|
|
37
|
+
cache_instance = await _init_cache_instance(name)
|
|
27
38
|
}
|
|
28
|
-
return
|
|
39
|
+
return cache_instance
|
|
29
40
|
}
|
|
30
41
|
|
|
31
|
-
const get_cache_names = async () => {
|
|
32
|
-
|
|
42
|
+
const get_cache_names = async (pattern = "*") => {
|
|
43
|
+
const cache_mother = await _get_cache_mother(config, logger)
|
|
44
|
+
|
|
45
|
+
return await cache_mother.getKeys(pattern)
|
|
33
46
|
}
|
|
34
47
|
|
|
35
48
|
const drop_cache = async (name, clean = true) => {
|
|
@@ -43,21 +56,27 @@ export function init_context_cache(config, logger) {
|
|
|
43
56
|
}
|
|
44
57
|
}
|
|
45
58
|
}
|
|
46
|
-
|
|
59
|
+
|
|
60
|
+
const cache_mother = await _get_cache_mother(config, logger)
|
|
61
|
+
await cache_mother.unsetItem(name)
|
|
47
62
|
}
|
|
48
63
|
|
|
49
64
|
const close = async (clean = true) => {
|
|
65
|
+
const cache_mother = await _get_cache_mother(config, logger)
|
|
66
|
+
|
|
50
67
|
if (clean) {
|
|
51
|
-
|
|
68
|
+
const cache_names = await cache_mother.getKeys("*")
|
|
69
|
+
for (const name of cache_names) {
|
|
52
70
|
try {
|
|
71
|
+
const cache = await cache_mother.getItem(name)
|
|
53
72
|
await cache.close()
|
|
54
73
|
} catch (error) {
|
|
55
74
|
logger.warn(error)
|
|
56
75
|
}
|
|
57
76
|
}
|
|
58
77
|
}
|
|
59
|
-
|
|
60
|
-
|
|
78
|
+
await cache_mother.close()
|
|
79
|
+
_glob_cache_mother = undefined
|
|
61
80
|
}
|
|
62
81
|
|
|
63
82
|
const cache_ctx = {
|
|
@@ -27,6 +27,12 @@ function _miolo_cacher_options_merge(def, opt, logger) {
|
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
+
export function miolo_cacher_options_for_default(config, logger) {
|
|
31
|
+
const d = config.cache.default
|
|
32
|
+
|
|
33
|
+
return _miolo_cacher_options_merge(d, {}, logger)
|
|
34
|
+
}
|
|
35
|
+
|
|
30
36
|
export function miolo_cacher_options_for_calustra(config, logger) {
|
|
31
37
|
const d = config.cache.default
|
|
32
38
|
const c = config.cache.calustra
|
package/template/package.json
CHANGED
|
@@ -45,9 +45,9 @@
|
|
|
45
45
|
"intre": "^3.0.0-beta.4",
|
|
46
46
|
"joi": "^18.2.1",
|
|
47
47
|
"lucide-react": "^1.16.0",
|
|
48
|
-
"miolo-cli": "^3.0.0-beta.
|
|
48
|
+
"miolo-cli": "^3.0.0-beta.197",
|
|
49
49
|
"miolo-model": "file:../miolo-model",
|
|
50
|
-
"miolo-react": "^3.0.0-beta.
|
|
50
|
+
"miolo-react": "^3.0.0-beta.197",
|
|
51
51
|
"next-themes": "^0.4.6",
|
|
52
52
|
"radix-ui": "^1.4.3",
|
|
53
53
|
"react": "^19.2.6",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
64
|
"@biomejs/biome": "2.4.15",
|
|
65
|
-
"miolo": "^3.0.0-beta.
|
|
65
|
+
"miolo": "^3.0.0-beta.197",
|
|
66
66
|
"sass-embedded": "^1.99.0"
|
|
67
67
|
},
|
|
68
68
|
"overrides": {
|