Skip to content
module@warp-drive/experiments/storage

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

ts
new CacheStorage(cacheId): CacheStorage;

Defined in: storage/cache.ts:102

Parameters

cacheId

string

Returns

CacheStorage

Methods

clear()

ts
clear(): void;

Defined in: storage/cache.ts:136

The clear() method of the Storage interface clears all keys stored in a given Storage object.

MDN Reference

Returns

void

Implementation of

ts
Storage.clear

getItem()

ts
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.

MDN Reference

Parameters

key

string

Returns

null | string

Implementation of

ts
Storage.getItem

key()

ts
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.

MDN Reference

Parameters

index

number

Returns

null | string

Implementation of

ts
Storage.key

removeItem()

ts
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.

MDN Reference

Parameters

key

string

Returns

void

Implementation of

ts
Storage.removeItem

setItem()

ts
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.

MDN Reference

Parameters

key

string

value

string

Returns

void

Implementation of

ts
Storage.setItem

expectCache()

ts
static expectCache(cacheId): CacheStorage;

Defined in: storage/cache.ts:193

Parameters

cacheId

string = DEFAULT_CACHE_ID

Returns

CacheStorage


get()

ts
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()

ts
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

ts
_bufferedEvents: InternalCacheStorageEvent[] = [];

Defined in: storage/cache.ts:90


_data

ts
_data: Map<string, null | string>;

Defined in: storage/cache.ts:88


_nextUpdate

ts
_nextUpdate: null | number = null;

Defined in: storage/cache.ts:89

length

Get Signature

ts
get length(): number;

Defined in: storage/cache.ts:108

The length read-only property of the Storage object.

MDN Reference

Returns

number

Implementation of

ts
Storage.length

Released under the MIT License.