(func: Function | string, data: any)
| 23 | } |
| 24 | |
| 25 | function _getCachePath(func: Function | string, data: any): string { |
| 26 | const fnName = getFnName(func); |
| 27 | |
| 28 | const serializedData = JSON.stringify(data); |
| 29 | const dataHash = crypto.createHash('md5').update(serializedData).digest('hex'); |
| 30 | const cachePath = path.join(Cache.cacheDirectory, fnName, `${dataHash}.json`); |
| 31 | return cachePath; |
| 32 | } |
| 33 | |
| 34 | function _hash(data: any): string { |
| 35 | const serializedData = JSON.stringify(data); |