Skip to content

channelCache.setValue

Signature: channelCache.setValue(key, value)

Returns: String previousValue - the previous value associated with the key

Set the value associated with the key.

Note

The channel cache is not thread-safe. It is designed for static configuration values. For frequently updated data, please use an external database to ensure data consistency and avoid performance issues.

Note

See this KB article for examples on how to use channel cache variables.

Parameters

Type Name Description Default
String key a unique string used to identify the cached value
String value the new value to associate with the 'key'

Example

// Set a value in the channel cache
channelCache.setValue("lastName", "Smith");

// Retrieve the cached value
var value = channelCache.getValue("lastName"); // Smith