@envelop/response-cache-redis 1.2.0 → 1.2.1-alpha-20220901205925-b1fd44a9

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/README.md CHANGED
@@ -22,6 +22,7 @@ In order to use the Redis cache, you need to:
22
22
  - Create an instance of the Redis Cache and set to the `useResponseCache` plugin options
23
23
 
24
24
  ```ts
25
+ import { parse, validate, execute, subscribe } from 'graphql'
25
26
  import { envelop } from '@envelop/core'
26
27
  import { useResponseCache } from '@envelop/response-cache'
27
28
  import { createRedisCache } from '@envelop/response-cache-redis'
@@ -44,6 +45,10 @@ const redis = new Redis('rediss://:1234567890@my-redis-db.example.com:30652')
44
45
  const cache = createRedisCache({ redis })
45
46
 
46
47
  const getEnveloped = envelop({
48
+ parse,
49
+ validate,
50
+ execute,
51
+ subscribe,
47
52
  plugins: [
48
53
  // ... other plugins ...
49
54
  useResponseCache({ cache })
@@ -54,6 +59,7 @@ const getEnveloped = envelop({
54
59
  ### Invalidate Cache based on custom logic
55
60
 
56
61
  ```ts
62
+ import { parse, validate, execute, subscribe } from 'graphql'
57
63
  import { envelop } from '@envelop/core'
58
64
  import { useResponseCache } from '@envelop/response-cache'
59
65
  import { createRedisCache } from '@envelop/response-cache-redis'
@@ -66,6 +72,10 @@ const redis = new Redis('rediss://:1234567890@my-redis-db.example.com:30652')
66
72
  const cache = createRedisCache({ redis })
67
73
 
68
74
  const getEnveloped = envelop({
75
+ parse,
76
+ validate,
77
+ execute,
78
+ subscribe,
69
79
  plugins: [
70
80
  // ... other plugins ...
71
81
  useResponseCache({
@@ -2,10 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.defaultBuildRedisOperationResultCacheKey = exports.defaultBuildRedisEntityId = exports.createRedisCache = void 0;
4
4
  const createRedisCache = (params) => {
5
- var _a, _b;
6
5
  const store = params.redis;
7
- const buildRedisEntityId = (_a = params === null || params === void 0 ? void 0 : params.buildRedisEntityId) !== null && _a !== void 0 ? _a : exports.defaultBuildRedisEntityId;
8
- const buildRedisOperationResultCacheKey = (_b = params === null || params === void 0 ? void 0 : params.buildRedisOperationResultCacheKey) !== null && _b !== void 0 ? _b : exports.defaultBuildRedisOperationResultCacheKey;
6
+ const buildRedisEntityId = params?.buildRedisEntityId ?? exports.defaultBuildRedisEntityId;
7
+ const buildRedisOperationResultCacheKey = params?.buildRedisOperationResultCacheKey ?? exports.defaultBuildRedisOperationResultCacheKey;
9
8
  async function buildEntityInvalidationsKeys(entity) {
10
9
  const keysToInvalidate = [entity];
11
10
  // find the responseIds for the entity
@@ -1,8 +1,7 @@
1
1
  export const createRedisCache = (params) => {
2
- var _a, _b;
3
2
  const store = params.redis;
4
- const buildRedisEntityId = (_a = params === null || params === void 0 ? void 0 : params.buildRedisEntityId) !== null && _a !== void 0 ? _a : defaultBuildRedisEntityId;
5
- const buildRedisOperationResultCacheKey = (_b = params === null || params === void 0 ? void 0 : params.buildRedisOperationResultCacheKey) !== null && _b !== void 0 ? _b : defaultBuildRedisOperationResultCacheKey;
3
+ const buildRedisEntityId = params?.buildRedisEntityId ?? defaultBuildRedisEntityId;
4
+ const buildRedisOperationResultCacheKey = params?.buildRedisOperationResultCacheKey ?? defaultBuildRedisOperationResultCacheKey;
6
5
  async function buildEntityInvalidationsKeys(entity) {
7
6
  const keysToInvalidate = [entity];
8
7
  // find the responseIds for the entity
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@envelop/response-cache-redis",
3
- "version": "1.2.0",
3
+ "version": "1.2.1-alpha-20220901205925-b1fd44a9",
4
4
  "sideEffects": false,
5
5
  "peerDependencies": {},
6
6
  "dependencies": {
7
- "@envelop/response-cache": "^3.2.0",
7
+ "@envelop/response-cache": "3.2.1-alpha-20220901205925-b1fd44a9",
8
8
  "ioredis": "^4.27.9",
9
9
  "tslib": "^2.4.0"
10
10
  },