@puca/puca-core 14.7.9 → 14.8.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@puca/puca-core",
3
- "version": "14.7.9",
3
+ "version": "14.8.1",
4
4
  "description": "",
5
5
  "author": "Raphael Aguiar",
6
6
  "license": "UNLICENSED",
@@ -1,7 +0,0 @@
1
- export declare class RequestCacheService {
2
- private readonly cache;
3
- private readonly subCache;
4
- get<T>(key: string | any, fallback: () => Promise<T>): Promise<T>;
5
- getSubCache(path: string): RequestCacheService;
6
- private buildKeyStr;
7
- }
@@ -1,36 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RequestCacheService = void 0;
4
- const crypto_1 = require("crypto");
5
- class RequestCacheService {
6
- constructor() {
7
- this.cache = new Map();
8
- this.subCache = new Map();
9
- }
10
- async get(key, fallback) {
11
- const keyStr = this.buildKeyStr(key);
12
- const cached = this.cache.get(keyStr);
13
- if (cached) {
14
- return cached;
15
- }
16
- const value = await fallback();
17
- this.cache.set(keyStr, value);
18
- return value;
19
- }
20
- getSubCache(path) {
21
- if (this.subCache.has(path)) {
22
- return this.subCache.get(path);
23
- }
24
- const subCache = new RequestCacheService();
25
- this.subCache.set(path, subCache);
26
- return subCache;
27
- }
28
- buildKeyStr(key) {
29
- if (typeof key === 'string') {
30
- return key;
31
- }
32
- return (0, crypto_1.createHash)('md5').update(JSON.stringify(key || 'void')).digest('hex');
33
- }
34
- }
35
- exports.RequestCacheService = RequestCacheService;
36
- //# sourceMappingURL=request-cache.service.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"request-cache.service.js","sourceRoot":"","sources":["../../../src/core/services/request-cache.service.ts"],"names":[],"mappings":";;;AAAA,mCAAmC;AAEnC,MAAa,mBAAmB;IAAhC;QACmB,UAAK,GAAG,IAAI,GAAG,EAAe,CAAA;QAC9B,a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