Added clear function to cache
This commit is contained in:
parent
0f10aebfd2
commit
b21f462d35
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@ztimson/utils",
|
"name": "@ztimson/utils",
|
||||||
"version": "0.20.2",
|
"version": "0.20.3",
|
||||||
"description": "Utility library",
|
"description": "Utility library",
|
||||||
"author": "Zak Timson",
|
"author": "Zak Timson",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
@ -87,6 +87,13 @@ export class Cache<K extends string | number | symbol, T> {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove all keys from cache
|
||||||
|
*/
|
||||||
|
clear() {
|
||||||
|
this.store = <Record<K, T>>{};
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete an item from the cache
|
* Delete an item from the cache
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user