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, namespace becomes a required field.

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 false

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