Skip to main content

reporting.cache

Cache data on-device for your extension.

clear()

clear(): void

Clear the cache for your extension.

Returns

void


get()

get<T>(key, defaultValue): T

Retrieve a value from the cache. If the key isn't in the cache, this will return the provided defaultValue. If the type of value in the cache doesn't match the type of the defaultValue, the defaultValue is returned.

Type Parameters

Type Parameter
T

Parameters

ParameterTypeDescription
keystringThe unique key for your extension for the cache value.
defaultValueTThe value returned if no value is found in the cache.

Returns

T


replace()

replace(newCache): void

Replace the entire existing cache with a new cache.

Parameters

ParameterTypeDescription
newCacheCacheThe new cache you'd like to persist.

Returns

void


set()

set<T>(key, value): void

Add a key-value pair to the cache. Will overwrite any existing value at the key.

Type Parameters

Type Parameter
T

Parameters

ParameterTypeDescription
keystringThe unique key for your extension for the cache value.
valueTThe value you'd like to store.

Returns

void