ApplicationStorage
Represents an application storage object to manipulate key-value pairs. Add the following line to your scenario code to use the class:
require(Modules.ApplicationStorage);
Methods
delete
delete(key: string
): Promise<StorageKey>
Deletes the specified key. Note that the returned StorageKey always has zero ttl.
Parameters
key:
string
Key to delete.
Returns
type:
Promise<StorageKey>
get
get(key: string
): Promise<StorageKey,null>
Retrieves a value of the specified key.
Parameters
key:
string
Key to get
Returns
type:
Promise<StorageKey,null>
keys
keys(pattern: string
): Promise<StoragePage>
Retrieves all the keys assigned to a Voximplant application.
Parameters
pattern:
string
OptionalNamespace that keys should contain
Returns
type:
Promise<StoragePage>
put
put(key: string
, value: string
, ttl: number
): Promise<StorageKey>
Creates a key-value pair. If an already existing key is passed, the method updates its value.The keys should be unique within a Voximplant application.
Parameters
key:
string
Key to create/update, up to 200 characters. A key can contain a namespace that is written before a colon, for example, test:1234. Thus, namespace "test" can be used as a pattern in the keys method to find the keys with the same namespace. If no namespace is set, the key itself is considered as namespace
value:
string
Value for the specified key, up to 2000 characters
ttl:
number
Key expiry time in seconds. The value is in range of 0..7,776,000 (90 days). The TTL is converted to an
expireAt
Unix timestamp field as part of the storage object. Note that the pricing is tiered in three day-based pieces: 0-30, 31-60, 61-90. See the details here
Returns
type:
Promise<StorageKey>