moderator-toolbox-nxg-for-reddit / util/persistence/cache
util/persistence/cache¶
Functions¶
clearCache()¶
clearCache():
Promise<unknown>
Defined in: extension/data/util/persistence/cache.ts:28
Wipes every cache key, both in memory and in storage.
Returns¶
Promise<unknown>
getCache()¶
getCache<
T>(moduleID,key,defaultVal?):Promise<T>
Defined in: extension/data/util/persistence/cache.ts:45
Reads a cached value, returning the default when nothing is stored or the entry has expired.
Type Parameters¶
T¶
T = unknown
Parameters¶
moduleID¶
string
Module that owns the cache key.
key¶
string
Name of the cache key.
defaultVal?¶
T
Value returned when there is no live cached value.
Returns¶
Promise<T>
setCache()¶
setCache(
moduleID,key,inputValue):Promise<unknown>
Defined in: extension/data/util/persistence/cache.ts:76
Writes a value into the cache and resolves with the value that was stored.
Parameters¶
moduleID¶
string
Module that owns the cache key.
key¶
string
Name of the cache key.
inputValue¶
unknown
New value to store under the key.
Returns¶
Promise<unknown>