@envelop/response-cache-redis 1.0.1 → 1.0.3-alpha-62b6e087.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,10 +1,10 @@
1
1
  {
2
2
  "name": "@envelop/response-cache-redis",
3
- "version": "1.0.1",
3
+ "version": "1.0.3-alpha-62b6e087.0",
4
4
  "sideEffects": false,
5
5
  "peerDependencies": {},
6
6
  "dependencies": {
7
- "@envelop/response-cache": "^3.0.1",
7
+ "@envelop/response-cache": "3.0.3-alpha-62b6e087.0",
8
8
  "ioredis": "^4.27.9"
9
9
  },
10
10
  "repository": {
@@ -24,7 +24,7 @@
24
24
  "exports": {
25
25
  ".": {
26
26
  "require": {
27
- "types": "./typings/index.d.ts",
27
+ "types": "./typings/index.d.cts",
28
28
  "default": "./cjs/index.js"
29
29
  },
30
30
  "import": {
@@ -38,7 +38,7 @@
38
38
  },
39
39
  "./*": {
40
40
  "require": {
41
- "types": "./typings/*.d.ts",
41
+ "types": "./typings/*.d.cts",
42
42
  "default": "./cjs/*.js"
43
43
  },
44
44
  "import": {
@@ -0,0 +1 @@
1
+ export * from './redis-cache.cjs';
@@ -0,0 +1,24 @@
1
+ import Redis from 'ioredis';
2
+ import type { Cache } from '@envelop/response-cache';
3
+ export declare type BuildRedisEntityId = (typename: string, id: number | string) => string;
4
+ export declare type BuildRedisOperationResultCacheKey = (responseId: string) => string;
5
+ export declare type RedisCacheParameter = {
6
+ /**
7
+ * Redis instance
8
+ * @see Redis.Redis https://github.com/luin/ioredis
9
+ */
10
+ redis: Redis.Redis;
11
+ /**
12
+ * Customize how the cache entity id is built.
13
+ * By default the typename is concatenated with the id e.g. `User:1`
14
+ */
15
+ buildRedisEntityId?: BuildRedisEntityId;
16
+ /**
17
+ * Customize how the cache key that stores the operations associated with the response is built.
18
+ * By default `operations` is concatenated with the responseId e.g. `operations:arZm3tCKgGmpu+a5slrpSH9vjSQ=`
19
+ */
20
+ buildRedisOperationResultCacheKey?: BuildRedisOperationResultCacheKey;
21
+ };
22
+ export declare const createRedisCache: (params: RedisCacheParameter) => Cache;
23
+ export declare const defaultBuildRedisEntityId: BuildRedisEntityId;
24
+ export declare const defaultBuildRedisOperationResultCacheKey: BuildRedisOperationResultCacheKey;