Skip to content

sharedCache.removeAllValues

Signature: sharedCache.removeAllValues(namespace*, global*, persist*)

Returns: Collection<java.lang.Object> removedValues - the Collection of values for the Shared Cache

Remove all of the shared cache values associated with the namespace.

When no namespace is specified, only the values set in the current channel are removed. When a namespace is specified, the values stored under that namespace across the same zone are removed. When global is set to true, the values stored under the namespace across all zones are removed.

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 values to remove {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: Remove all values from the shared cache.

 // Populate 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)
 );

 // Remove all the shared cache values for the current namespace
 sharedCache.removeAllValues();

 // Optionally remove all shared cache values for a named namespace (global scope)
 sharedCache.removeAllValues(
    "dates", // namespace
    true     // global
 );