@spoosh/plugin-gc 0.3.0 → 0.4.0
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/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +4 -3
- package/dist/index.mjs +6 -3
- package/package.json +4 -4
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as _spoosh_core from '@spoosh/core';
|
|
2
2
|
|
|
3
3
|
type GcPluginOptions = {
|
|
4
4
|
/**
|
|
@@ -51,8 +51,8 @@ type GcPluginExports = {
|
|
|
51
51
|
* const removedCount = runGc();
|
|
52
52
|
* ```
|
|
53
53
|
*/
|
|
54
|
-
declare function gcPlugin(options?: GcPluginOptions): SpooshPlugin<{
|
|
55
|
-
|
|
54
|
+
declare function gcPlugin(options?: GcPluginOptions): _spoosh_core.SpooshPlugin<{
|
|
55
|
+
api: GcPluginExports;
|
|
56
56
|
}>;
|
|
57
57
|
|
|
58
58
|
export { type GcPluginExports, type GcPluginOptions, gcPlugin };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as _spoosh_core from '@spoosh/core';
|
|
2
2
|
|
|
3
3
|
type GcPluginOptions = {
|
|
4
4
|
/**
|
|
@@ -51,8 +51,8 @@ type GcPluginExports = {
|
|
|
51
51
|
* const removedCount = runGc();
|
|
52
52
|
* ```
|
|
53
53
|
*/
|
|
54
|
-
declare function gcPlugin(options?: GcPluginOptions): SpooshPlugin<{
|
|
55
|
-
|
|
54
|
+
declare function gcPlugin(options?: GcPluginOptions): _spoosh_core.SpooshPlugin<{
|
|
55
|
+
api: GcPluginExports;
|
|
56
56
|
}>;
|
|
57
57
|
|
|
58
58
|
export { type GcPluginExports, type GcPluginOptions, gcPlugin };
|
package/dist/index.js
CHANGED
|
@@ -25,6 +25,7 @@ __export(src_exports, {
|
|
|
25
25
|
module.exports = __toCommonJS(src_exports);
|
|
26
26
|
|
|
27
27
|
// src/plugin.ts
|
|
28
|
+
var import_core = require("@spoosh/core");
|
|
28
29
|
var PLUGIN_NAME = "spoosh:gc";
|
|
29
30
|
function runGarbageCollection(stateManager, eventTracer, options) {
|
|
30
31
|
const { maxAge, maxEntries } = options;
|
|
@@ -73,7 +74,7 @@ function runGarbageCollection(stateManager, eventTracer, options) {
|
|
|
73
74
|
function gcPlugin(options = {}) {
|
|
74
75
|
const { interval = 6e4 } = options;
|
|
75
76
|
let runGcFn;
|
|
76
|
-
return {
|
|
77
|
+
return (0, import_core.createSpooshPlugin)({
|
|
77
78
|
name: PLUGIN_NAME,
|
|
78
79
|
operations: [],
|
|
79
80
|
setup(context) {
|
|
@@ -97,12 +98,12 @@ function gcPlugin(options = {}) {
|
|
|
97
98
|
runGcFn?.();
|
|
98
99
|
}, interval);
|
|
99
100
|
},
|
|
100
|
-
|
|
101
|
+
api() {
|
|
101
102
|
return {
|
|
102
103
|
runGc: () => runGcFn?.() ?? 0
|
|
103
104
|
};
|
|
104
105
|
}
|
|
105
|
-
};
|
|
106
|
+
});
|
|
106
107
|
}
|
|
107
108
|
// Annotate the CommonJS export names for ESM import in node:
|
|
108
109
|
0 && (module.exports = {
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
// src/plugin.ts
|
|
2
|
+
import {
|
|
3
|
+
createSpooshPlugin
|
|
4
|
+
} from "@spoosh/core";
|
|
2
5
|
var PLUGIN_NAME = "spoosh:gc";
|
|
3
6
|
function runGarbageCollection(stateManager, eventTracer, options) {
|
|
4
7
|
const { maxAge, maxEntries } = options;
|
|
@@ -47,7 +50,7 @@ function runGarbageCollection(stateManager, eventTracer, options) {
|
|
|
47
50
|
function gcPlugin(options = {}) {
|
|
48
51
|
const { interval = 6e4 } = options;
|
|
49
52
|
let runGcFn;
|
|
50
|
-
return {
|
|
53
|
+
return createSpooshPlugin({
|
|
51
54
|
name: PLUGIN_NAME,
|
|
52
55
|
operations: [],
|
|
53
56
|
setup(context) {
|
|
@@ -71,12 +74,12 @@ function gcPlugin(options = {}) {
|
|
|
71
74
|
runGcFn?.();
|
|
72
75
|
}, interval);
|
|
73
76
|
},
|
|
74
|
-
|
|
77
|
+
api() {
|
|
75
78
|
return {
|
|
76
79
|
runGc: () => runGcFn?.() ?? 0
|
|
77
80
|
};
|
|
78
81
|
}
|
|
79
|
-
};
|
|
82
|
+
});
|
|
80
83
|
}
|
|
81
84
|
export {
|
|
82
85
|
gcPlugin
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spoosh/plugin-gc",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Garbage collection plugin for Spoosh cache with time and size-based cleanup",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -34,10 +34,10 @@
|
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
|
-
"@spoosh/core": ">=0.
|
|
37
|
+
"@spoosh/core": ">=0.17.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@spoosh/core": "0.
|
|
40
|
+
"@spoosh/core": "0.17.0",
|
|
41
41
|
"@spoosh/test-utils": "0.3.0"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|
|
@@ -45,6 +45,6 @@
|
|
|
45
45
|
"build": "tsup",
|
|
46
46
|
"typecheck": "tsc --noEmit",
|
|
47
47
|
"lint": "eslint src --max-warnings 0",
|
|
48
|
-
"format": "prettier --write 'src/**/*.ts'"
|
|
48
|
+
"format": "prettier --write 'src/**/*.ts' '*.md'"
|
|
49
49
|
}
|
|
50
50
|
}
|