Skip to content

sharedCache.removeValue

Signature: sharedCache.removeValue(key, namespace*, global*, persist*)

Returns: void

Remove an object from the thread-safe cache.

The scope from which the value is removed is determined by the namespace and global parameters. When no namespace is specified, the value is removed only from the channel in which it was set. When a namespace was specified at set time, the value is removed from all channels in the same zone. When global was set to true at set time, the value is removed across all zones.

Note

Enter the same namespace and global options that were used when the value was set.

Parameters

Type Name Description Default
String key a unique string used to identify the cached value
String namespace* (optional) a unique string used to limit the scope of the value Channel ID
Boolean global* (optional) specifies whether or not the value is stored in the global cache false
Boolean persist* (optional) specifies whether or not the value is stored in the database false

Example

// Example: Remove a value from the shared cache.

// Populate the shared cache
var hashMap = new java.util.HashMap();
hashMap.put("Today", new java.util.Date(qie.getSystemTimeMilliseconds()));

sharedCache.setValue(
    "the map", // key
    hashMap,   // value
    600        // TTL (seconds)
);

// Remove the cached value
sharedCache.removeValue("the map");