@miermontoto/cached-dynamo 1.0.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/README.md +84 -0
- package/dist/helpers.d.ts +12 -0
- package/dist/helpers.d.ts.map +1 -0
- package/dist/helpers.js +20 -0
- package/dist/helpers.js.map +1 -0
- package/dist/index.d.ts +72 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +241 -0
- package/dist/index.js.map +1 -0
- package/dist/interfaces.d.ts +16 -0
- package/dist/interfaces.d.ts.map +1 -0
- package/dist/interfaces.js +3 -0
- package/dist/interfaces.js.map +1 -0
- package/package.json +50 -0
package/README.md
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# @miermontoto/cached-dynamo
|
|
2
|
+
|
|
3
|
+
DynamoDB wrapper with built-in local memory caching, combining @miermontoto/dynamo and @miermontoto/local-cache.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add @miermontoto/cached-dynamo
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Configuration
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
interface CachedDynamoConfig extends DynamoWrapperConfig {
|
|
15
|
+
cache?: {
|
|
16
|
+
enabled?: boolean; // enable/disable cache, default true
|
|
17
|
+
prefix?: string; // cache key prefix, defaults to table name
|
|
18
|
+
ttl?: number; // TTL in seconds for cached items
|
|
19
|
+
instanceName?: string; // cache instance name, defaults to table name
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Usage
|
|
25
|
+
|
|
26
|
+
```typescript
|
|
27
|
+
import { CachedDynamoWrapper } from '@miermontoto/cached-dynamo';
|
|
28
|
+
|
|
29
|
+
// initialize with cache
|
|
30
|
+
const dynamo = new CachedDynamoWrapper({
|
|
31
|
+
tableName: 'my-table',
|
|
32
|
+
partitionKey: 'userId',
|
|
33
|
+
sortKey: 'timestamp',
|
|
34
|
+
region: 'us-east-1',
|
|
35
|
+
credentials: {
|
|
36
|
+
accessKeyId: process.env.AWS_ACCESS_KEY_ID,
|
|
37
|
+
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,
|
|
38
|
+
},
|
|
39
|
+
cache: {
|
|
40
|
+
enabled: true,
|
|
41
|
+
prefix: 'users',
|
|
42
|
+
ttl: 300, // 5 minutes
|
|
43
|
+
instanceName: 'user-cache',
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
// get item (checks cache first, then DynamoDB)
|
|
48
|
+
const user = await dynamo.get('user-123', 1234567890);
|
|
49
|
+
|
|
50
|
+
// put item (saves to both DynamoDB and cache)
|
|
51
|
+
await dynamo.put({
|
|
52
|
+
userId: 'user-123',
|
|
53
|
+
timestamp: Date.now(),
|
|
54
|
+
name: 'John Doe',
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
// query with automatic cache population
|
|
58
|
+
const userItems = await dynamo.query('user-123');
|
|
59
|
+
|
|
60
|
+
// batch operations with cache optimization
|
|
61
|
+
const items = await dynamo.batchGet([
|
|
62
|
+
{ userId: 'user-123', timestamp: 1234567890 },
|
|
63
|
+
{ userId: 'user-456', timestamp: 1234567891 },
|
|
64
|
+
]);
|
|
65
|
+
|
|
66
|
+
// cache management
|
|
67
|
+
dynamo.clearCache(); // clear all cached items
|
|
68
|
+
dynamo.getCacheSize(); // get number of cached items
|
|
69
|
+
dynamo.setCacheEnabled(false); // disable cache temporarily
|
|
70
|
+
dynamo.isCacheEnabled(); // check if cache is enabled
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Features
|
|
74
|
+
|
|
75
|
+
- **Automatic caching**: Transparently caches DynamoDB responses
|
|
76
|
+
- **TTL support**: Configure expiration time for cached items
|
|
77
|
+
- **Query optimization**: Caches query results by prefix
|
|
78
|
+
- **Batch optimization**: Checks cache before making batch requests
|
|
79
|
+
- **Cache invalidation**: Automatically invalidates cache on updates/deletes
|
|
80
|
+
- **Multiple instances**: Support for different cache instances per table
|
|
81
|
+
|
|
82
|
+
## License
|
|
83
|
+
|
|
84
|
+
CC BY-NC-ND 4.0
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* genera una clave única para el caché
|
|
3
|
+
*/
|
|
4
|
+
export declare function generateCacheKey(prefix: string, partitionValue: string | number, sortValue?: string | number): string;
|
|
5
|
+
/**
|
|
6
|
+
* extrae valores de partition y sort de un item
|
|
7
|
+
*/
|
|
8
|
+
export declare function extractKeys(item: any, partitionKey: string, sortKey?: string): {
|
|
9
|
+
partitionValue: string | number;
|
|
10
|
+
sortValue?: string | number;
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,MAAM,EACd,cAAc,EAAE,MAAM,GAAG,MAAM,EAC/B,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,GAC1B,MAAM,CAGR;AAED;;GAEG;AACH,wBAAgB,WAAW,CACzB,IAAI,EAAE,GAAG,EACT,YAAY,EAAE,MAAM,EACpB,OAAO,CAAC,EAAE,MAAM,GACf;IAAE,cAAc,EAAE,MAAM,GAAG,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,CAIlE"}
|
package/dist/helpers.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateCacheKey = generateCacheKey;
|
|
4
|
+
exports.extractKeys = extractKeys;
|
|
5
|
+
/**
|
|
6
|
+
* genera una clave única para el caché
|
|
7
|
+
*/
|
|
8
|
+
function generateCacheKey(prefix, partitionValue, sortValue) {
|
|
9
|
+
const key = `${prefix}:${partitionValue}`;
|
|
10
|
+
return sortValue !== undefined ? `${key}:${sortValue}` : key;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* extrae valores de partition y sort de un item
|
|
14
|
+
*/
|
|
15
|
+
function extractKeys(item, partitionKey, sortKey) {
|
|
16
|
+
const partitionValue = item[partitionKey];
|
|
17
|
+
const sortValue = sortKey ? item[sortKey] : undefined;
|
|
18
|
+
return { partitionValue, sortValue };
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":";;AAGA,4CAOC;AAKD,kCAQC;AAvBD;;GAEG;AACH,SAAgB,gBAAgB,CAC9B,MAAc,EACd,cAA+B,EAC/B,SAA2B;IAE3B,MAAM,GAAG,GAAG,GAAG,MAAM,IAAI,cAAc,EAAE,CAAC;IAC1C,OAAO,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,GAAG,GAAG,IAAI,SAAS,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC;AAC/D,CAAC;AAED;;GAEG;AACH,SAAgB,WAAW,CACzB,IAAS,EACT,YAAoB,EACpB,OAAgB;IAEhB,MAAM,cAAc,GAAG,IAAI,CAAC,YAAY,CAAC,CAAC;IAC1C,MAAM,SAAS,GAAG,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACtD,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,CAAC;AACvC,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { DynamoItem, DynamoWrapper, QueryOptions, UpdateOptions } from "@miermontoto/dynamo";
|
|
2
|
+
import { CachedDynamoConfig } from "./interfaces";
|
|
3
|
+
/**
|
|
4
|
+
* wrapper de dynamodb con caché local en memoria
|
|
5
|
+
* combina @miermontoto/dynamo con @miermontoto/local-cache
|
|
6
|
+
*/
|
|
7
|
+
export declare class CachedDynamoWrapper extends DynamoWrapper {
|
|
8
|
+
private readonly cache;
|
|
9
|
+
private readonly cacheConfig;
|
|
10
|
+
protected readonly partitionKey: string;
|
|
11
|
+
protected readonly sortKey?: string;
|
|
12
|
+
constructor(config: CachedDynamoConfig);
|
|
13
|
+
/**
|
|
14
|
+
* genera la clave de caché para un item
|
|
15
|
+
*/
|
|
16
|
+
private getCacheKey;
|
|
17
|
+
/**
|
|
18
|
+
* obtiene un item con caché
|
|
19
|
+
*/
|
|
20
|
+
get<T extends DynamoItem>(partitionValue: string | number, sortValue?: string | number): Promise<T | null>;
|
|
21
|
+
/**
|
|
22
|
+
* guarda un item en dynamodb y caché
|
|
23
|
+
*/
|
|
24
|
+
put<T extends DynamoItem>(item: T): Promise<boolean>;
|
|
25
|
+
/**
|
|
26
|
+
* actualiza un item en dynamodb e invalida caché
|
|
27
|
+
*/
|
|
28
|
+
update<T extends DynamoItem>(partitionValue: string | number, sortValue: string | number | undefined, attributes: Partial<T>, options?: UpdateOptions): Promise<boolean>;
|
|
29
|
+
/**
|
|
30
|
+
* elimina un item de dynamodb y caché
|
|
31
|
+
*/
|
|
32
|
+
delete(partitionValue: string | number, sortValue?: string | number): Promise<boolean>;
|
|
33
|
+
/**
|
|
34
|
+
* query con caché por prefijo
|
|
35
|
+
*/
|
|
36
|
+
query<T extends DynamoItem>(partitionValue: string | number, options?: QueryOptions): Promise<T[]>;
|
|
37
|
+
/**
|
|
38
|
+
* obtiene múltiples items con caché
|
|
39
|
+
*/
|
|
40
|
+
batchGet<T extends DynamoItem>(keys: Array<{
|
|
41
|
+
[key: string]: string | number;
|
|
42
|
+
}>): Promise<T[]>;
|
|
43
|
+
/**
|
|
44
|
+
* guarda múltiples items en dynamodb y caché
|
|
45
|
+
*/
|
|
46
|
+
batchPut<T extends DynamoItem>(items: T[]): Promise<boolean>;
|
|
47
|
+
/**
|
|
48
|
+
* elimina múltiples items de dynamodb y caché
|
|
49
|
+
*/
|
|
50
|
+
batchDelete(keys: Array<{
|
|
51
|
+
[key: string]: string | number;
|
|
52
|
+
}>): Promise<boolean>;
|
|
53
|
+
/**
|
|
54
|
+
* limpia todo el caché local
|
|
55
|
+
*/
|
|
56
|
+
clearCache(): void;
|
|
57
|
+
/**
|
|
58
|
+
* obtiene el tamaño del caché
|
|
59
|
+
*/
|
|
60
|
+
getCacheSize(): number;
|
|
61
|
+
/**
|
|
62
|
+
* habilita o deshabilita el caché
|
|
63
|
+
*/
|
|
64
|
+
setCacheEnabled(enabled: boolean): void;
|
|
65
|
+
/**
|
|
66
|
+
* verifica si el caché está habilitado
|
|
67
|
+
*/
|
|
68
|
+
isCacheEnabled(): boolean;
|
|
69
|
+
}
|
|
70
|
+
export * from "./helpers";
|
|
71
|
+
export * from "./interfaces";
|
|
72
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,aAAa,EACb,YAAY,EACZ,aAAa,EACd,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EAAe,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAE/D;;;GAGG;AACH,qBAAa,mBAAoB,SAAQ,aAAa;IACpD,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAa;IACnC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAc;IAC1C,SAAS,CAAC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IACxC,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;gBAExB,MAAM,EAAE,kBAAkB;IAkBtC;;OAEG;IACH,OAAO,CAAC,WAAW;IAOnB;;OAEG;IACG,GAAG,CAAC,CAAC,SAAS,UAAU,EAC5B,cAAc,EAAE,MAAM,GAAG,MAAM,EAC/B,SA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AY,IAAI,MAAM;IAItB;;OAEG;IACH,eAAe,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;IAIvC;;OAEG;IACH,cAAc,IAAI,OAAO;CAG1B;AAED,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.CachedDynamoWrapper = void 0;
|
|
18
|
+
const dynamo_1 = require("@miermontoto/dynamo");
|
|
19
|
+
const local_cache_1 = require("@miermontoto/local-cache");
|
|
20
|
+
const helpers_1 = require("./helpers");
|
|
21
|
+
/**
|
|
22
|
+
* wrapper de dynamodb con caché local en memoria
|
|
23
|
+
* combina @miermontoto/dynamo con @miermontoto/local-cache
|
|
24
|
+
*/
|
|
25
|
+
class CachedDynamoWrapper extends dynamo_1.DynamoWrapper {
|
|
26
|
+
constructor(config) {
|
|
27
|
+
super(config);
|
|
28
|
+
this.partitionKey = config.partitionKey;
|
|
29
|
+
this.sortKey = config.sortKey;
|
|
30
|
+
// configurar caché
|
|
31
|
+
this.cacheConfig = {
|
|
32
|
+
enabled: config.cache?.enabled ?? true,
|
|
33
|
+
prefix: config.cache?.prefix ?? config.tableName,
|
|
34
|
+
ttl: config.cache?.ttl,
|
|
35
|
+
instanceName: config.cache?.instanceName ?? config.tableName,
|
|
36
|
+
};
|
|
37
|
+
// obtener instancia de caché
|
|
38
|
+
this.cache = local_cache_1.LocalCache.getInstance(this.cacheConfig.instanceName);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* genera la clave de caché para un item
|
|
42
|
+
*/
|
|
43
|
+
getCacheKey(partitionValue, sortValue) {
|
|
44
|
+
return (0, helpers_1.generateCacheKey)(this.cacheConfig.prefix, partitionValue, sortValue);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* obtiene un item con caché
|
|
48
|
+
*/
|
|
49
|
+
async get(partitionValue, sortValue) {
|
|
50
|
+
const cacheKey = this.getCacheKey(partitionValue, sortValue);
|
|
51
|
+
// buscar en caché local si está habilitado
|
|
52
|
+
if (this.cacheConfig.enabled) {
|
|
53
|
+
const cachedItem = this.cache.get(cacheKey);
|
|
54
|
+
if (cachedItem) {
|
|
55
|
+
return cachedItem;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
// buscar en dynamodb
|
|
59
|
+
const item = await super.get(partitionValue, sortValue);
|
|
60
|
+
// guardar en caché si existe y está habilitado
|
|
61
|
+
if (item && this.cacheConfig.enabled) {
|
|
62
|
+
this.cache.set(cacheKey, item, this.cacheConfig.ttl);
|
|
63
|
+
}
|
|
64
|
+
return item;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* guarda un item en dynamodb y caché
|
|
68
|
+
*/
|
|
69
|
+
async put(item) {
|
|
70
|
+
// guardar en dynamodb
|
|
71
|
+
const success = await super.put(item);
|
|
72
|
+
// guardar en caché si está habilitado y fue exitoso
|
|
73
|
+
if (success && this.cacheConfig.enabled) {
|
|
74
|
+
const { partitionValue, sortValue } = (0, helpers_1.extractKeys)(item, this.partitionKey, this.sortKey);
|
|
75
|
+
const cacheKey = this.getCacheKey(partitionValue, sortValue);
|
|
76
|
+
this.cache.set(cacheKey, item, this.cacheConfig.ttl);
|
|
77
|
+
}
|
|
78
|
+
return success;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* actualiza un item en dynamodb e invalida caché
|
|
82
|
+
*/
|
|
83
|
+
async update(partitionValue, sortValue, attributes, options) {
|
|
84
|
+
// actualizar en dynamodb
|
|
85
|
+
const success = await super.update(partitionValue, sortValue, attributes, options);
|
|
86
|
+
// invalidar caché si está habilitado y fue exitoso
|
|
87
|
+
if (success && this.cacheConfig.enabled) {
|
|
88
|
+
const cacheKey = this.getCacheKey(partitionValue, sortValue);
|
|
89
|
+
this.cache.delete(cacheKey);
|
|
90
|
+
}
|
|
91
|
+
return success;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* elimina un item de dynamodb y caché
|
|
95
|
+
*/
|
|
96
|
+
async delete(partitionValue, sortValue) {
|
|
97
|
+
// eliminar de dynamodb
|
|
98
|
+
const success = await super.delete(partitionValue, sortValue);
|
|
99
|
+
// eliminar de caché si está habilitado
|
|
100
|
+
if (this.cacheConfig.enabled) {
|
|
101
|
+
const cacheKey = this.getCacheKey(partitionValue, sortValue);
|
|
102
|
+
this.cache.delete(cacheKey);
|
|
103
|
+
}
|
|
104
|
+
return success;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* query con caché por prefijo
|
|
108
|
+
*/
|
|
109
|
+
async query(partitionValue, options) {
|
|
110
|
+
const cachePrefix = `${this.cacheConfig.prefix}:${partitionValue}`;
|
|
111
|
+
// buscar en caché local si está habilitado y no hay opciones complejas
|
|
112
|
+
if (this.cacheConfig.enabled &&
|
|
113
|
+
!options?.filterExpression &&
|
|
114
|
+
!options?.indexName) {
|
|
115
|
+
const cachedItems = this.cache.query(cachePrefix);
|
|
116
|
+
if (cachedItems.length > 0) {
|
|
117
|
+
// aplicar límite si existe
|
|
118
|
+
if (options?.limit) {
|
|
119
|
+
return cachedItems.slice(0, options.limit);
|
|
120
|
+
}
|
|
121
|
+
return cachedItems;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
// buscar en dynamodb
|
|
125
|
+
const items = await super.query(partitionValue, options);
|
|
126
|
+
// guardar en caché si está habilitado y es una query simple
|
|
127
|
+
if (items.length > 0 &&
|
|
128
|
+
this.cacheConfig.enabled &&
|
|
129
|
+
!options?.filterExpression &&
|
|
130
|
+
!options?.indexName) {
|
|
131
|
+
items.forEach((item) => {
|
|
132
|
+
const { partitionValue: pv, sortValue: sv } = (0, helpers_1.extractKeys)(item, this.partitionKey, this.sortKey);
|
|
133
|
+
const cacheKey = this.getCacheKey(pv, sv);
|
|
134
|
+
this.cache.set(cacheKey, item, this.cacheConfig.ttl);
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
return items;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* obtiene múltiples items con caché
|
|
141
|
+
*/
|
|
142
|
+
async batchGet(keys) {
|
|
143
|
+
const results = [];
|
|
144
|
+
const missingKeys = [];
|
|
145
|
+
// buscar en caché primero si está habilitado
|
|
146
|
+
if (this.cacheConfig.enabled) {
|
|
147
|
+
for (const key of keys) {
|
|
148
|
+
const partitionValue = key[this.partitionKey];
|
|
149
|
+
const sortValue = this.sortKey ? key[this.sortKey] : undefined;
|
|
150
|
+
const cacheKey = this.getCacheKey(partitionValue, sortValue);
|
|
151
|
+
const cached = this.cache.get(cacheKey);
|
|
152
|
+
if (cached) {
|
|
153
|
+
results.push(cached);
|
|
154
|
+
}
|
|
155
|
+
else {
|
|
156
|
+
missingKeys.push(key);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
missingKeys.push(...keys);
|
|
162
|
+
}
|
|
163
|
+
// buscar items faltantes en dynamodb
|
|
164
|
+
if (missingKeys.length > 0) {
|
|
165
|
+
const dynamoItems = await super.batchGet(missingKeys);
|
|
166
|
+
// guardar en caché si está habilitado
|
|
167
|
+
if (this.cacheConfig.enabled) {
|
|
168
|
+
dynamoItems.forEach((item) => {
|
|
169
|
+
const { partitionValue, sortValue } = (0, helpers_1.extractKeys)(item, this.partitionKey, this.sortKey);
|
|
170
|
+
const cacheKey = this.getCacheKey(partitionValue, sortValue);
|
|
171
|
+
this.cache.set(cacheKey, item, this.cacheConfig.ttl);
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
results.push(...dynamoItems);
|
|
175
|
+
}
|
|
176
|
+
return results;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* guarda múltiples items en dynamodb y caché
|
|
180
|
+
*/
|
|
181
|
+
async batchPut(items) {
|
|
182
|
+
// guardar en dynamodb
|
|
183
|
+
const success = await super.batchPut(items);
|
|
184
|
+
// guardar en caché si está habilitado y fue exitoso
|
|
185
|
+
if (success && this.cacheConfig.enabled) {
|
|
186
|
+
items.forEach((item) => {
|
|
187
|
+
const { partitionValue, sortValue } = (0, helpers_1.extractKeys)(item, this.partitionKey, this.sortKey);
|
|
188
|
+
const cacheKey = this.getCacheKey(partitionValue, sortValue);
|
|
189
|
+
this.cache.set(cacheKey, item, this.cacheConfig.ttl);
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
return success;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* elimina múltiples items de dynamodb y caché
|
|
196
|
+
*/
|
|
197
|
+
async batchDelete(keys) {
|
|
198
|
+
// eliminar de dynamodb
|
|
199
|
+
const success = await super.batchDelete(keys);
|
|
200
|
+
// eliminar de caché si está habilitado
|
|
201
|
+
if (this.cacheConfig.enabled) {
|
|
202
|
+
keys.forEach((key) => {
|
|
203
|
+
const partitionValue = key[this.partitionKey];
|
|
204
|
+
const sortValue = this.sortKey ? key[this.sortKey] : undefined;
|
|
205
|
+
const cacheKey = this.getCacheKey(partitionValue, sortValue);
|
|
206
|
+
this.cache.delete(cacheKey);
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
return success;
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* limpia todo el caché local
|
|
213
|
+
*/
|
|
214
|
+
clearCache() {
|
|
215
|
+
if (this.cacheConfig.enabled) {
|
|
216
|
+
this.cache.clear();
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* obtiene el tamaño del caché
|
|
221
|
+
*/
|
|
222
|
+
getCacheSize() {
|
|
223
|
+
return this.cacheConfig.enabled ? this.cache.size() : 0;
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* habilita o deshabilita el caché
|
|
227
|
+
*/
|
|
228
|
+
setCacheEnabled(enabled) {
|
|
229
|
+
this.cacheConfig.enabled = enabled;
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* verifica si el caché está habilitado
|
|
233
|
+
*/
|
|
234
|
+
isCacheEnabled() {
|
|
235
|
+
return this.cacheConfig.enabled;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
exports.CachedDynamoWrapper = CachedDynamoWrapper;
|
|
239
|
+
__exportStar(require("./helpers"), exports);
|
|
240
|
+
__exportStar(require("./interfaces"), exports);
|
|
241
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,gDAK6B;AAC7B,0DAAsD;AACtD,uCAA0D;AAG1D;;;GAGG;AACH,MAAa,mBAAoB,SAAQ,sBAAa;IAMpD,YAAY,MAA0B;QACpC,KAAK,CAAC,MAAM,CAAC,CAAC;QAEd,IAAI,CAAC,YAAY,GAAG,MAAM,CAAC,YAAY,CAAC;QACxC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;QAE9B,mBAAmB;QACnB,IAAI,CAAC,WAAW,GAAG;YACjB,OAA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I,CAAC,WAAW,CAAC,OAAO,GAAG,OAAO,CAAC;IACrC,CAAC;IAED;;OAEG;IACH,cAAc;QACZ,OAAO,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC;IAClC,CAAC;CACF;AA7SD,kDA6SC;AAED,4CAA0B;AAC1B,+CAA6B"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { DynamoWrapperConfig } from '@miermontoto/dynamo';
|
|
2
|
+
export interface CachedDynamoConfig extends DynamoWrapperConfig {
|
|
3
|
+
cache?: {
|
|
4
|
+
enabled?: boolean;
|
|
5
|
+
prefix?: string;
|
|
6
|
+
ttl?: number;
|
|
7
|
+
instanceName?: string;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export interface CacheConfig {
|
|
11
|
+
enabled: boolean;
|
|
12
|
+
prefix: string;
|
|
13
|
+
ttl?: number;
|
|
14
|
+
instanceName?: string;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=interfaces.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE1D,MAAM,WAAW,kBAAmB,SAAQ,mBAAmB;IAC7D,KAAK,CAAC,EAAE;QACN,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,CAAC;CACH;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"author": "Juan Mier",
|
|
3
|
+
"bugs": {
|
|
4
|
+
"url": "https://github.com/miermontoto/packages/issues"
|
|
5
|
+
},
|
|
6
|
+
"dependencies": {
|
|
7
|
+
"@miermontoto/dynamo": "^1.0.1",
|
|
8
|
+
"@miermontoto/local-cache": "^1.0.0"
|
|
9
|
+
},
|
|
10
|
+
"description": "DynamoDB wrapper with built-in local memory caching",
|
|
11
|
+
"devDependencies": {
|
|
12
|
+
"@types/node": "^20.0.0",
|
|
13
|
+
"rimraf": "^6.0.1",
|
|
14
|
+
"typescript": "^5.9.2"
|
|
15
|
+
},
|
|
16
|
+
"engines": {
|
|
17
|
+
"node": ">=16.0.0"
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"dist"
|
|
21
|
+
],
|
|
22
|
+
"homepage": "https://github.com/miermontoto/packages#readme",
|
|
23
|
+
"keywords": [
|
|
24
|
+
"dynamodb",
|
|
25
|
+
"cache",
|
|
26
|
+
"aws",
|
|
27
|
+
"database",
|
|
28
|
+
"nosql",
|
|
29
|
+
"typescript",
|
|
30
|
+
"wrapper",
|
|
31
|
+
"memory"
|
|
32
|
+
],
|
|
33
|
+
"license": "CC BY-NC-ND 4.0",
|
|
34
|
+
"main": "dist/index.js",
|
|
35
|
+
"name": "@miermontoto/cached-dynamo",
|
|
36
|
+
"publishConfig": {
|
|
37
|
+
"access": "public",
|
|
38
|
+
"registry": "https://registry.npmjs.org/"
|
|
39
|
+
},
|
|
40
|
+
"repository": {
|
|
41
|
+
"type": "git",
|
|
42
|
+
"url": "git+https://github.com/miermontoto/packages.git"
|
|
43
|
+
},
|
|
44
|
+
"types": "dist/index.d.ts",
|
|
45
|
+
"version": "1.0.0",
|
|
46
|
+
"scripts": {
|
|
47
|
+
"build": "rimraf dist && tsc",
|
|
48
|
+
"build:watch": "tsc --watch"
|
|
49
|
+
}
|
|
50
|
+
}
|