Products · Dash API
Cache
Keep values on the phone for a while, each with an optional expiry time.
A dot's own key-value cache, apart from its files. It holds up to 64 MB of JSON values, each kept until removed or until its ttl runs out.
dash.storage.cache.get
dash.storage.cache.get<Value extends CacheValue = CacheValue>(key: string, callOptions?: CallOptions): DashRequest<Value | null>Resolves with null for a missing or expired key.
Types: CacheValue
dash.storage.cache.set
dash.storage.cache.set(key: string, value: CacheValue, options?: CacheSetOptions, callOptions?: CallOptions): DashRequest<void>Saves value under key. Give { ttl } in milliseconds to have it expire, such as 60 000 for a minute; without it, the value stays until you remove it.
Types: CacheValue, CacheSetOptions
dash.storage.cache.remove
dash.storage.cache.remove(key: string, callOptions?: CallOptions): DashRequest<void>Deletes the value saved under key.
dash.storage.cache.exists
dash.storage.cache.exists(key: string, callOptions?: CallOptions): DashRequest<boolean>Whether a value is saved under key and hasn't expired.
dash.storage.cache.keys
dash.storage.cache.keys(callOptions?: CallOptions): DashRequest<string[]>Every key with a value that hasn't expired, sorted.
dash.storage.cache.clear
dash.storage.cache.clear(callOptions?: CallOptions): DashRequest<void>Deletes everything in the dot's cache.
Types
CacheValue
type CacheValue = string | number | boolean | CacheValue[] | { [key: string]: CacheValue };CacheSetOptions
| Field | Type | What it is |
|---|---|---|
ttl (optional) | number | How many milliseconds the entry lasts. Without it, or with 0 or less, it lasts until removed. |
Keep reading
SecretsKeep small private values, such as a session token, encrypted on the phone.CryptoWork out hashes and HMAC signatures, and make random bytes and UUIDs.UtilsConvert text to base64 or hex and back, without waiting for Dash.DotClose the dot from your code, the same as going back from its first page.