@expo/entity-cache-adapter-redis 0.54.0 → 0.57.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expo/entity-cache-adapter-redis",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.57.0",
|
|
4
4
|
"description": "Redis cache adapter for @expo/entity",
|
|
5
5
|
"files": [
|
|
6
6
|
"build",
|
|
@@ -28,18 +28,18 @@
|
|
|
28
28
|
"author": "Expo",
|
|
29
29
|
"license": "MIT",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@expo/entity": "^0.
|
|
31
|
+
"@expo/entity": "^0.57.0"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
34
|
"ioredis": ">=5"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@expo/batcher": "1.0.0",
|
|
38
|
-
"@expo/entity-testing-utils": "^0.
|
|
38
|
+
"@expo/entity-testing-utils": "^0.57.0",
|
|
39
39
|
"@jest/globals": "30.2.0",
|
|
40
|
-
"ioredis": "5.9.
|
|
40
|
+
"ioredis": "5.9.3",
|
|
41
41
|
"ts-mockito": "2.6.1",
|
|
42
42
|
"typescript": "5.9.3"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "e876cfb27bb9b0004d81b40c9067481e3e0c2beb"
|
|
45
45
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Batcher } from '@expo/batcher';
|
|
2
2
|
import {
|
|
3
|
-
|
|
3
|
+
GenericEntityCacheAdapter,
|
|
4
4
|
SingleFieldHolder,
|
|
5
5
|
SingleFieldValueHolder,
|
|
6
6
|
ViewerContext,
|
|
@@ -109,12 +109,11 @@ describe(GenericRedisCacher, () => {
|
|
|
109
109
|
|
|
110
110
|
const mgetSpy = jest.spyOn(redis, 'mget');
|
|
111
111
|
|
|
112
|
-
const genericCacher =
|
|
113
|
-
RedisTestEntity
|
|
114
|
-
|
|
115
|
-
RedisTestEntityFields,
|
|
116
|
-
|
|
117
|
-
>;
|
|
112
|
+
const genericCacher = (
|
|
113
|
+
viewerContext.entityCompanionProvider.getCompanionForEntity(RedisTestEntity)[
|
|
114
|
+
'tableDataCoordinator'
|
|
115
|
+
]['cacheAdapter'] as GenericEntityCacheAdapter<RedisTestEntityFields, 'id'>
|
|
116
|
+
)['genericCacher'];
|
|
118
117
|
|
|
119
118
|
const entity1Created = await RedisTestEntity.creator(viewerContext)
|
|
120
119
|
.setField('name', 'blah')
|
|
@@ -187,7 +186,9 @@ describe(GenericRedisCacher, () => {
|
|
|
187
186
|
expect(entityNonExistentResult2.ok).toBe(false);
|
|
188
187
|
|
|
189
188
|
// invalidate from cache to ensure it invalidates correctly in both caches
|
|
190
|
-
await RedisTestEntity.
|
|
189
|
+
await RedisTestEntity.invalidationUtils(viewerContext).invalidateFieldsAsync(
|
|
190
|
+
entity1.getAllFields(),
|
|
191
|
+
);
|
|
191
192
|
await expect(redis.get(cacheKeyEntity1)).resolves.toBeNull();
|
|
192
193
|
await expect(redis.get(cacheKeyEntity1NameField)).resolves.toBeNull();
|
|
193
194
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CompositeFieldHolder,
|
|
3
3
|
CompositeFieldValueHolder,
|
|
4
|
-
|
|
4
|
+
GenericEntityCacheAdapter,
|
|
5
5
|
SingleFieldHolder,
|
|
6
6
|
SingleFieldValueHolder,
|
|
7
7
|
ViewerContext,
|
|
@@ -55,12 +55,11 @@ describe(GenericRedisCacher, () => {
|
|
|
55
55
|
const viewerContext = new TestViewerContext(
|
|
56
56
|
createRedisIntegrationTestEntityCompanionProvider(genericRedisCacheContext),
|
|
57
57
|
);
|
|
58
|
-
const genericCacher =
|
|
59
|
-
RedisTestEntity
|
|
60
|
-
|
|
61
|
-
RedisTestEntityFields,
|
|
62
|
-
|
|
63
|
-
>;
|
|
58
|
+
const genericCacher = (
|
|
59
|
+
viewerContext.entityCompanionProvider.getCompanionForEntity(RedisTestEntity)[
|
|
60
|
+
'tableDataCoordinator'
|
|
61
|
+
]['cacheAdapter'] as GenericEntityCacheAdapter<RedisTestEntityFields, 'id'>
|
|
62
|
+
)['genericCacher'];
|
|
64
63
|
|
|
65
64
|
const entity1Created = await RedisTestEntity.creator(viewerContext)
|
|
66
65
|
.setField('name', 'blah')
|
|
@@ -144,7 +143,9 @@ describe(GenericRedisCacher, () => {
|
|
|
144
143
|
expect(entityNonExistentCompositeResult2).toBe(null);
|
|
145
144
|
|
|
146
145
|
// invalidate from cache to ensure it invalidates correctly
|
|
147
|
-
await RedisTestEntity.
|
|
146
|
+
await RedisTestEntity.invalidationUtils(viewerContext).invalidateFieldsAsync(
|
|
147
|
+
entity1.getAllFields(),
|
|
148
|
+
);
|
|
148
149
|
const cachedValueNullKeys = genericCacher.makeCacheKeysForInvalidation(
|
|
149
150
|
new SingleFieldHolder('id'),
|
|
150
151
|
new SingleFieldValueHolder(entity1.getID()),
|
|
@@ -109,7 +109,7 @@ describe(GenericRedisCacher, () => {
|
|
|
109
109
|
return pipeline;
|
|
110
110
|
},
|
|
111
111
|
);
|
|
112
|
-
when(mockPipeline.exec()).thenResolve(
|
|
112
|
+
when(mockPipeline.exec()).thenResolve([]);
|
|
113
113
|
const pipeline = instance(mockPipeline);
|
|
114
114
|
|
|
115
115
|
const mockRedisClient = mock<Redis>();
|
|
@@ -154,7 +154,7 @@ describe(GenericRedisCacher, () => {
|
|
|
154
154
|
return pipeline;
|
|
155
155
|
},
|
|
156
156
|
);
|
|
157
|
-
when(mockPipeline.exec()).thenResolve(
|
|
157
|
+
when(mockPipeline.exec()).thenResolve([]);
|
|
158
158
|
const pipeline = instance(mockPipeline);
|
|
159
159
|
|
|
160
160
|
const mockRedisClient = mock<Redis>();
|