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
OptionalReturn keys that begin with a pattern
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 will update its value.The keys should be unique within a Voximplant application.
Parameters
key:
string
Key to create/update
value:
string
Value for the specified key
ttl:
number
Key expiry time in seconds. The value is in range of 0..7,776,000 (90 days). Default value is 30 days (2,592,000 seconds); values larger than 90 days are automatically rounded down to 90. 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>