* Fixed cache expiry
This commit is contained in:
parent
76b570b3fe
commit
cf122ef9e8
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@ztimson/utils",
|
"name": "@ztimson/utils",
|
||||||
"version": "0.24.11",
|
"version": "0.24.12",
|
||||||
"description": "Utility library",
|
"description": "Utility library",
|
||||||
"author": "Zak Timson",
|
"author": "Zak Timson",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
@ -172,7 +172,7 @@ export class Cache<K extends string | number | symbol, T> {
|
|||||||
* @return {this}
|
* @return {this}
|
||||||
*/
|
*/
|
||||||
set(key: K, value: T, ttl = this.options.ttl): this {
|
set(key: K, value: T, ttl = this.options.ttl): this {
|
||||||
if(this.options.expiryPolicy == 'keep') delete (<any>this.store[key])._expired;
|
if(this.options.expiryPolicy == 'keep') delete (<any>value)._expired;
|
||||||
this.store[key] = value;
|
this.store[key] = value;
|
||||||
this.save();
|
this.save();
|
||||||
if(ttl) setTimeout(() => {
|
if(ttl) setTimeout(() => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user