Directus / @directus/memory / index / Cache
Interface: Cache ​
Methods ​
clear() ​
clear():
Promise
<void
>
Remove all keys from the cache
Returns ​
Promise
<void
>
Defined in ​
packages/memory/src/cache/types/class.ts:35
delete() ​
delete(
key
):Promise
<void
>
Remove the given key from the cache
Parameters ​
• key: string
Key to remove from the cache
Returns ​
Promise
<void
>
Defined in ​
packages/memory/src/cache/types/class.ts:23
get() ​
get<
T
>(key
):Promise
<undefined
|T
>
Get the cached value by key. Returns undefined if the key doesn't exist in the cache
Type Parameters ​
• T = unknown
Parameters ​
• key: string
Key to retrieve from the cache
Returns ​
Promise
<undefined
| T
>
Cached value, or undefined if key doesn't exist
Defined in ​
packages/memory/src/cache/types/class.ts:8
has() ​
has(
key
):Promise
<boolean
>
Check if a given key exists in the cache
Parameters ​
• key: string
Key to check
Returns ​
Promise
<boolean
>
Defined in ​
packages/memory/src/cache/types/class.ts:30
set() ​
set<
T
>(key
,value
):Promise
<void
>
Save the given value to the cache
Type Parameters ​
• T = unknown
Parameters ​
• key: string
Key to save in the cache
• value: T
Value to save to the cache. Can be any JavaScript primitive, plain object, or array
Returns ​
Promise
<void
>