fix(core): update

This commit is contained in:
2020-02-03 20:08:57 +00:00
parent b5667be823
commit 51c1759961
9 changed files with 201 additions and 150 deletions

View File

@@ -5,8 +5,8 @@ export class SmartCache {
private _cacheManager = new CacheManager();
async cacheReturn(asyncCachedFuncArg: () => Promise<any>, cacheDuration: number = 5000) {
let callStack: string = new plugins.smarterror.SmartError('').cleanFullStack;
let callHash = plugins.smarthash.sha256FromStringSync(callStack);
const callStack: string = new plugins.smarterror.SmartError('Cache Creation Point').cleanFullStack.split('\n')[2];
const callHash = plugins.smarthash.sha256FromStringSync(callStack);
// console.log(callHash);
if (
@@ -17,7 +17,7 @@ export class SmartCache {
return this._cacheManager.getCache(callHash).cachedObject;
} else {
this._cacheManager.announceCache(callHash, cacheDuration);
let newCachedObject = await asyncCachedFuncArg();
const newCachedObject = await asyncCachedFuncArg();
this._cacheManager.setCache(callHash, newCachedObject, cacheDuration);
return newCachedObject;
}