anote-server-libs 0.7.2 → 0.7.3
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.
|
@@ -50,9 +50,9 @@ class MemoryCache {
|
|
|
50
50
|
else
|
|
51
51
|
return Promise.resolve(this.localCache[key]);
|
|
52
52
|
}
|
|
53
|
-
set(key, val) {
|
|
53
|
+
set(key, val, time = 15 * 60) {
|
|
54
54
|
if (this.cache)
|
|
55
|
-
return new Promise(resolve => this.cache.set(this.localKey + key, JSON.stringify(val),
|
|
55
|
+
return new Promise(resolve => this.cache.set(this.localKey + key, JSON.stringify(val), time, resolve));
|
|
56
56
|
else {
|
|
57
57
|
this.localCache[key] = val;
|
|
58
58
|
return Promise.resolve();
|
|
@@ -48,8 +48,8 @@ export class MemoryCache<T> {
|
|
|
48
48
|
else return Promise.resolve(this.localCache[key]);
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
set(key: string | number, val: T): Promise<void> {
|
|
52
|
-
if(this.cache) return new Promise(resolve => this.cache.set(this.localKey + key, JSON.stringify(val),
|
|
51
|
+
set(key: string | number, val: T, time = 15 * 60): Promise<void> {
|
|
52
|
+
if(this.cache) return new Promise(resolve => this.cache.set(this.localKey + key, JSON.stringify(val), time, resolve));
|
|
53
53
|
else {
|
|
54
54
|
this.localCache[key] = val;
|
|
55
55
|
return Promise.resolve();
|