sharedCache.keySet¶
Signature: sharedCache.keySet(namespace*, global*, persist*)
Returns: Set<java.lang.Object> keys - the Set of keys for the Shared Cache
Get the shared cache keySet associated with the namespace.
When no namespace is specified, only the keys set in the current channel are returned. When a namespace is specified, the keys stored under that namespace across the same zone are returned. When global is set to true, the keys 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 set of keys stored in the shared cache.
// Populate the shared cache
var simpleString = "I am just a simple String";
var hashMap = new java.util.HashMap();
hashMap.put("Today", new java.util.Date(qie.getSystemTimeMilliseconds()));
hashMap.put("Jon's Bday", qie.deduceDate("2001-09-17"));
sharedCache.setValue("the map", hashMap, 600);
sharedCache.setValue("simple", simpleString);
// Get the set of keys in the shared cache
var keySet = sharedCache.keySet(); // Set<java.lang.Object>
// Note: order is not guaranteed