@travetto/cache
Advanced tools
Comparing version 0.0.7 to 0.0.8
@@ -24,3 +24,3 @@ { | ||
}, | ||
"version": "0.0.7" | ||
"version": "0.0.8" | ||
} |
@@ -20,3 +20,3 @@ import { CacheManager } from '../service'; | ||
if (!cache.has(key)) { | ||
const res = orig.apply(this, args || []); | ||
const res = orig.apply(this, args || []); // tslint:disable-line no-invalid-this | ||
if (res && res.catch && res.then) { // If a promise, clear on error | ||
@@ -23,0 +23,0 @@ res.catch((e: any) => cache.del(key)); |
@@ -17,6 +17,6 @@ import { Shutdown } from '@travetto/base'; | ||
if (!this.caches.has(name)) { | ||
config = Object.assign({}, | ||
this.defaultConfig, | ||
(config as any) || {} | ||
) as LRU.Options<string, T> & { name: string }; | ||
config = { | ||
...this.defaultConfig, | ||
...(config as any) || {} | ||
} as LRU.Options<string, T> & { name: string }; | ||
const cache = LRU<string, T>(config); | ||
@@ -23,0 +23,0 @@ this.caches.set(name, cache); |
@@ -86,3 +86,2 @@ import { Cacheable, CacheManager } from '../src'; | ||
for (const y of [1, 2]) { | ||
@@ -89,0 +88,0 @@ for (const x of [1, 2, 3, 4, 5, 6]) { |
5683