exframe-cache-manager 2.2.0 → 2.2.1
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/index.cjs +5 -0
- package/index.mjs +3 -0
- package/package.json +9 -2
- package/{index.js → src/cacheManager/index.js} +1 -1
- package/test/cacheManager.test.js +5 -5
package/index.cjs
ADDED
package/index.mjs
ADDED
package/package.json
CHANGED
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "exframe-cache-manager",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.1",
|
|
4
4
|
"description": "Managing the cache",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"import": "./index.mjs",
|
|
10
|
+
"require": "./index.cjs",
|
|
11
|
+
"default": "./index.mjs"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
7
14
|
"config": {
|
|
8
15
|
"reporter": "mocha-exzeo-reporter"
|
|
9
16
|
},
|
|
@@ -47,5 +54,5 @@
|
|
|
47
54
|
"url": "https://bitbucket.org/exzeo-usa/exframe",
|
|
48
55
|
"directory": "packages/exframe-cache-manager"
|
|
49
56
|
},
|
|
50
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "1e58908906f3408a98bf3e81546feb516db1412d"
|
|
51
58
|
}
|
|
@@ -253,7 +253,7 @@ function cachemanager(options) {
|
|
|
253
253
|
}
|
|
254
254
|
|
|
255
255
|
// eslint-disable-next-line import/prefer-default-export
|
|
256
|
-
export { cachemanager
|
|
256
|
+
export { cachemanager };
|
|
257
257
|
|
|
258
258
|
/**
|
|
259
259
|
* @typedef {RedisCacheManagerOptions & { store?: any, ttl?: number, db?: number }} Options
|
|
@@ -6,7 +6,7 @@ import service from 'exframe-service';
|
|
|
6
6
|
import health from 'exframe-health';
|
|
7
7
|
import { setTimeout as waitTimeout } from 'node:timers/promises';
|
|
8
8
|
|
|
9
|
-
import
|
|
9
|
+
import cacheManager from '../index.mjs';
|
|
10
10
|
|
|
11
11
|
const { prometheusClient } = service;
|
|
12
12
|
const userId = 'auth0|1234567890';
|
|
@@ -36,7 +36,7 @@ context('Test User Profile Middleware', () => {
|
|
|
36
36
|
it('adds a health check with the instance ID in the name, check function, and liveness timeout of 60 seconds', () => {
|
|
37
37
|
const healthAddSpy = sinonInstance.spy(health, 'add');
|
|
38
38
|
|
|
39
|
-
const instance = create(options);
|
|
39
|
+
const instance = cacheManager.create(options);
|
|
40
40
|
expect(healthAddSpy.calledOnce).to.equal(true);
|
|
41
41
|
expect(healthAddSpy.calledWithMatch(`redis-${instance.id}`, match.func, { promotionTimeout: 60000 })).to.be.true;
|
|
42
42
|
});
|
|
@@ -44,7 +44,7 @@ context('Test User Profile Middleware', () => {
|
|
|
44
44
|
it('registers a service resource with the instance ID in the name, onSignal function, and order of "last"', () => {
|
|
45
45
|
const registerSpy = sinonInstance.spy(service, 'registerResource');
|
|
46
46
|
|
|
47
|
-
const instance = create(options);
|
|
47
|
+
const instance = cacheManager.create(options);
|
|
48
48
|
expect(registerSpy.calledOnce).to.equal(true);
|
|
49
49
|
expect(registerSpy.calledWithMatch(`exframe-cache-manager-${instance.id}`, match({
|
|
50
50
|
onSignal: match.func,
|
|
@@ -54,7 +54,7 @@ context('Test User Profile Middleware', () => {
|
|
|
54
54
|
});
|
|
55
55
|
|
|
56
56
|
describe('instance', () => {
|
|
57
|
-
const app = create(options);
|
|
57
|
+
const app = cacheManager.create(options);
|
|
58
58
|
|
|
59
59
|
beforeEach(() => {
|
|
60
60
|
prometheusClient.register.clear();
|
|
@@ -178,7 +178,7 @@ context('Test User Profile Middleware', () => {
|
|
|
178
178
|
});
|
|
179
179
|
|
|
180
180
|
it('close drains the redis pool', async () => {
|
|
181
|
-
const app1 = create(options);
|
|
181
|
+
const app1 = cacheManager.create(options);
|
|
182
182
|
await app1.setItem(cacheKey, 'someValue');
|
|
183
183
|
const value = await app1.getItem(cacheKey);
|
|
184
184
|
expect(value).to.eql('someValue');
|