sharedCache.valueSet¶
Signature: sharedCache.valueSet(namespace*, global*, persist*)
Returns: Collection<java.lang.Object> values - the Collection of values for the Shared Cache
Get the shared cache valueSet collection associated with the namespace.
When no namespace is specified, only the values set in the current channel are returned. When a namespace is specified, the values stored under that namespace across the same zone are returned. When global is set to true, the values stored under the namespace across all zones are returned.
Note
When global is set to true and no namespace is supplied, one shared global namespace is used, which every channel in every zone can read and write. Supply a namespace to keep global values apart.
Note
namespace is optional. When not specified, {channel ID} scopes the value to the channel running the script, so no other channel can see it.
Note
persist is optional. When not specified, {system default} is the Default Storage setting on the System Config page under Shared Cache Settings.
Parameters¶
| Type | Name | Description | Default |
|---|---|---|---|
| String | namespace* | (optional) a unique string used to limit the scope of the shared cache | {channel ID} |
| Boolean | global* | (optional) specifies whether or not the shared cache is a global cache | false |
| Boolean | persist* | (optional) specifies whether or not the shared cache is stored in the database | {system default} |
Example¶
// Example: Retrieve the collection of values stored in the shared cache.
// Populate the shared cache with a namespaced entry
var map = new java.util.HashMap();
map.put("Today", new java.util.Date(qie.getSystemTimeMilliseconds()));
map.put("Jon's Bday", qie.deduceDate("2001-09-17"));
sharedCache.setValue(
"dates", // key
map, // value
600 // TTL (seconds)
);
sharedCache.setValue(
"something", // key
"important", // value
600 // TTL (seconds)
);
// Get all values from the shared cache
var values = sharedCache.valueSet(); // Collection<java.lang.Object>
// Note: order is not guaranteed and values may be of mixed types