Defined in: storage/cache.ts:84
A reactive interface for json stored in the browser Cache API.
This is a good option for larger data sets than can be efficiently stored in localStorage but should not be used as a permanent DB or storage solution.
Implements
Constructors
Constructor
new CacheStorage(cacheId): CacheStorage;Defined in: storage/cache.ts:102
Parameters
cacheId
string
Returns
CacheStorage
Methods
clear()
clear(): void;Defined in: storage/cache.ts:136
The clear() method of the Storage interface clears all keys stored in a given Storage object.
Returns
void
Implementation of
Storage.cleargetItem()
getItem(key): null | string;Defined in: storage/cache.ts:141
The getItem() method of the Storage interface, when passed a key name, will return that key's value, or null if the key does not exist, in the given Storage object.
Parameters
key
string
Returns
null | string
Implementation of
Storage.getItemkey()
key(index): null | string;Defined in: storage/cache.ts:145
The key() method of the Storage interface, when passed a number n, returns the name of the nth key in a given Storage object.
Parameters
index
number
Returns
null | string
Implementation of
Storage.keyremoveItem()
removeItem(key): void;Defined in: storage/cache.ts:161
The removeItem() method of the Storage interface, when passed a key name, will remove that key from the given Storage object if it exists.
Parameters
key
string
Returns
void
Implementation of
Storage.removeItemsetItem()
setItem(key, value): void;Defined in: storage/cache.ts:169
The setItem() method of the Storage interface, when passed a key name and value, will add that key to the given Storage object, or update that key's value if it already exists.
Parameters
key
string
value
string
Returns
void
Implementation of
Storage.setItemexpectCache()
static expectCache(cacheId): CacheStorage;Defined in: storage/cache.ts:193
Parameters
cacheId
string = DEFAULT_CACHE_ID
Returns
CacheStorage
get()
static get(cacheId): Promise<CacheStorage>;Defined in: storage/cache.ts:184
Get the singleton CacheStorage instance.
Parameters
cacheId
string = DEFAULT_CACHE_ID
Returns
Promise<CacheStorage>
getAllCacheIds()
static getAllCacheIds(): string[];Defined in: storage/cache.ts:205
Returns the IDs of all CacheStorage instances that have been opened in this context via CacheStorage.get.
Returns
string[]
Properties
_bufferedEvents
_bufferedEvents: InternalCacheStorageEvent[] = [];Defined in: storage/cache.ts:90
_data
_data: Map<string, null | string>;Defined in: storage/cache.ts:88
_nextUpdate
_nextUpdate: null | number = null;Defined in: storage/cache.ts:89
length
Get Signature
get length(): number;Defined in: storage/cache.ts:108
The length read-only property of the Storage object.
Returns
number
Implementation of
Storage.length