Cache Folder

You use the elements in the cache folder to place data in a cache and retrieve it again later. You can also use the services in the cache folder to perform administrative operations such as enabling, disabling, and clearing a cache, or to implement checkpoint restart in services you write. Integration Server uses Terracotta Ehcache internally for all of the services in the cache folder. Before using these services, you need to create a cache manager and cache using Integration Server Administrator. For instructions, see Understanding Caches and Cache Managers.

Note: You cannot use an IS document object as a key for storing objects in the cache because IS document objects do not implement the equals() method.

Requirements for the Cached Elements Key

Each cached element is associated with a key. Integration Server has the following requirements for the key value used in the pub.cache services:

  • The key must be immutable and serializable.
  • Use a java.lang.String for the key.
  • Do not use an IData object as a key as IData objects are mutable. If an IData object is used as the key when placing a value in cache using a pub.cache* service, later attempts to retrieve the value using the same key might fail.

    Integration Server includes the server configuration parameter watt.server.cache.iDataKey.toString that specifies whether a com.wm.data.IData object used as a key in one of the pub.cache* services is converted to an immutable String before accessing the cache. However, if the IData object is modified after it has been used as a key, Integration Server will not be able to retrieve values stored with the key regardless of the value of watt.server.cache.iDataKey.toString.

    Note: The watt.server.cache.iDataKey.toString parameter is available after applying a fix that includes PIE-83387 (IS_10.11_Core_Fix12).
  • The key must be an object that overrides the equals() method from java.lang.Object. Failure to use such an object can cause the service to return incorrect results.

About Checkpoint Restart

You can use the pub.cache services to implement checkpoint restart in services that you write to make them more robust. You use the pub.cache services to write state information and other pertinent data to the cache. If the Integration Server on which your service is executing becomes unavailable, your service will be able to check the state information in the cache and resume processing at the point where the service was interrupted.

Note: The pub.cache services are a tool for maintaining state information for the short term. It is up to the developer of the services to make sure they keep track of state information and correctly handle restarts.
The following diagram shows the logic of a flow service that uses checkpoint restart.
Overview of a flow service that uses checkpoint restart.

Summary of Elements in this Folder

The following elements are available in this folder:

Element Package and Description
pub.cache:containsKey WmPublic. Checks whether an element with the specified key exists in the cache.
pub.cache:get WmPublic. Retrieves the value of a cached element for the specified key.
pub.cache:getAll WmPublic. Retrieves the values of the cached elements for the specified keys.
pub.cache:getKeys WmPublic. Retrieves the keys of all elements available in the cache.
pub.cache:put WmPublic. Populates a cached element with a specified key-value pair.
pub.cache:putAll WmPublic. Populates a collection of elements in the cache with the specified key-value pairs.
pub.cache:remove WmPublic. Removes the cached element associated with the specified key.
pub.cache:removeAll WmPublic. Removes the cached elements associated with a list of keys or, if no keys are specified, removes all elements from the cache.
pub.cache:search WmPublic. Searches through an indexed cache and returns the results.
pub.cache.admin:clearAllCaches WmPublic. Deletes all of the elements from all caches contained in the specified cache manager.
pub.cache.admin:clearCache WmPublic. Deletes all elements from the specified cache.
pub.cache.admin:disableCache WmPublic. Disables a cache.
pub.cache.admin:enableCache WmPublic. Enables a cache.
pub.cache.admin:evictExpiredElements WmPublic. Deletes all of the expired elements from a cache.
pub.cache.admin:isCacheDisabled WmPublic. Checks whether the cache is disabled.
pub.cache.atomic:putIfAbsent WmPublic. Adds an element to the cache if the cache does not contain an element with the specified key.
pub.cache.atomic:remove WmPublic. Removes the cached element associated with the specified key and value.
pub.cache.atomic:replace WmPublic. Replaces the cached element value with the supplied value.
pub.cache.atomic:replaceIfKeyExists WmPublic. Replaces the cached element if an element for the specified key exists in a cache.
pub.cache.bulk:isClusterBulkLoadEnabled WmPublic. Checks whether the cache on at least one Integration Server node in the Terracotta Server Array cluster is enabled for bulk loading.
pub.cache.bulk:isNodeBulkLoadEnabled WmPublic. Checks whether the cache of the current Integration Server node in the Terracotta Server Array cluster is bulk-load enabled.
pub.cache.bulk:setNodeBulkLoadEnabled WmPublic. Enables or disables bulk loading mode in the current Integration Server node for the cache.
pub.cache.bulk:waitUntilClusterBulkLoadComplete WmPublic. Indicates whether Integration Server delays execution of the next step in a flow service until all of the Integration Server nodes in the Terracotta Server Array cluster disable bulk loading for the cache.
pub.cache.lock:acquireLock WmPublic. Acquires a lock on the cached element that contains the specified key.
pub.cache.lock:isLockedByCurrentThread WmPublic. Checks whether the current thread is holding a lock on the cached element for the specified key.
pub.cache.lock:releaseLock WmPublic. Releases a lock on the element for the specified key.
pub.cache.serviceResults:addCacheEntry WmPublic. Adds cached entry into service results for the service without executing the actual service. This service can be useful to perform bulk load of service results at Integration Server startup.
pub.cache.serviceResults:listServiceCache WmPublic. Returns a list of the cached service results for a particular service.
pub.cache.serviceResults:resetServerCache WmPublic. Resets the cache for all services in the service results cache, resulting in the removal of all cached service results for all services from the service results cache.
pub.cache.serviceResults:resetServiceCache WmPublic. Resets the cache for specific service, resulting in the removal of cached service results for the service.

pub.cache:containsKey

WmPublic. Checks whether an element with the specified key exists in the cache.

Input Parameters

cacheManagerName String Name of the cache manager that manages the cache. This parameter is case sensitive.
cacheName String Name of the cache that contains the key. This parameter is case sensitive.
key Object Key of the element for whose existence you are checking.

Output Parameters

found String Indicates whether the key exists in the cache.
  • true indicates that the key exists in the cache.
  • false indicates that the key does not exist in the cache.

Usage Notes

The pub.cache:containsKey service does not verify whether the element is expired. If the element of the specified key is expired, and the element is present in the cache, pub.cache:containsKey returns found with a value of true.

Integration Server issues a ServiceException in the following cases:

  • If you do not specify all required input parameters.
  • If Integration Server cannot find the specified cache manager or cache.
  • If a cache operation fails.

pub.cache:get

WmPublic. Retrieves the value of a cached element for the specified key.

Input Parameters

cacheManagerName String Name of the cache manager that manages the cache. This parameter is case sensitive.
cacheName String Name of the cache from which to retrieve the element. This parameter is case sensitive.
key Object Key associated with the cached value.
useLoader String Optional. Indicates whether to use a cache loader to retrieve the element from the cache. Set to:
  • true to use a cache loader to retrieve the element if it is not already in the cache.
    Note: If useLoader is true and no loaders are configured for the cache, Integration Server issues a ServiceException.
  • false to retrieve the element from the cache without a cache loader. This is the default setting.

Output Parameters

value Object Value of the element retrieved from the cache.

Usage Notes

If useLoader is set to false and pub.cache:get finds the key in the cache, the results contain the value of the element. If the key does not exist in the cache, pub.cache:get returns a null in the value parameter.

If useLoader is set to true and pub.cache:get cannot find the specified key in the cache, it uses the configured cache loader to find the key in the system-of-record (SOR). If the SOR contains the key, pub.cache:get returns the value of the element. If the key does not exist in the SOR, pub.cache:get returns a null in the value parameter.

The pub.cache:get service returns a null in the value parameter if:
  • You run the service on a disabled cache.
  • The service cannot find the specified key.
  • The element associated with the specified key is expired.

Integration Server issues a ServiceException in the following cases:

  • If useLoader is true and no loaders are configured for the cache.
  • If you do not specify all required input parameters.
  • If Integration Server cannot find the specified cache manager or cache.
  • If a cache operation fails.

pub.cache:getAll

WmPublic. Retrieves the values of the cached elements for the specified keys.

Input Parameters

cacheManagerName String Name of the cache manager that manages the cache. This parameter is case sensitive.
cacheName String Name of the cache from which to retrieve the elements. This parameter is case sensitive.
keys Object List Keys associated with the cached elements for which you want to retrieve values.
useLoader String Optional. Indicates whether to use a cache loader to retrieve the elements from the cache. Set to:
  • true to use a cache loader to retrieve an element if the element is not already in the cache.
    Note: If useLoader is true and no loaders are configured for the cache, Integration Server issues a ServiceException.
  • false to retrieve an element from the cache without a cache loader. This is the default setting.

Output Parameters

elements Document List An IData[] containing the values for the requested cached elements.
  Key Description
  key Object Key associated with the cached element.
  value Object Value of the element retrieved from the cache.

Usage Notes

The pub.cache:getAll service can be memory-intensive because it loads all of the specified keys into memory.

If useLoader is set to false and pub.cache:get finds the key in the cache, the results contain the value of the element. If the key does not exist in the cache, pub.cache:getAll returns a null in the value parameter.

If useLoader is set to true and pub.cache:get cannot find the specified key in the cache, it uses the configured cache loader to find the key in the system-of-record (SOR). If the SOR contains the key, pub.cache:get returns the value of the element. If the key does not exist in the SOR, pub.cache:getAll returns a null in the value parameter.

The pub.cache:getAll service returns a null in the elements/value parameter if:
  • You run the service on a disabled cache.
  • The service cannot find the specified key.
  • The element associated with the specified key is expired.

Integration Server issues a ServiceException in the following cases:

  • If useLoader is true and no loaders are configured for the cache.
  • If you do not specify all required input parameters.
  • If Integration Server cannot find the specified cache manager or cache.
  • If a cache operation fails.

pub.cache:getKeys

WmPublic. Retrieves the keys of all elements available in the cache.

Input Parameters

cacheManagerName String Name of the cache manager that manages the cache. This parameter is case sensitive.
cacheName String Name of the cache from which to retrieve the keys. This parameter is case sensitive.
excludeExpiredKeys String Optional. Indicates whether the service results exclude keys for expired elements. Set to:
  • true to exclude the keys of expired elements. This is the default.
  • false to include the keys of all elements.

Output Parameters

keys Object List List of keys of elements in the cache.

Usage Notes

Retrieving all of the keys from a cache may negatively impact the performance of the calling service. This may be especially true when retrieving all of the keys for a large, distributed cache.

Retrieving all of the keys from a cache is a memory-intensive activity. It is possible for the list of available keys to be larger than the memory available on your system. In such cases, Integration Server might issue an OutOfMemoryError and become unresponsive.

Integration Server issues a ServiceException in the following cases:

  • If you do not specify all required input parameters.
  • If Integration Server cannot find the specified cache manager or cache.
  • If a cache operation fails.

pub.cache:put

WmPublic. Populates a cached element with a specified key-value pair.

Input Parameters

cacheManagerName String Name of the cache manager that manages the cache. This parameter is case sensitive.
cacheName String Name of the cache in which to put the element. This parameter is case sensitive.
key Object Key of the cached element.
value Object Value of the cached element.
useWriter String Optional. Indicates whether to use a cache writer to populate the value of the cached element in the system-of-record (SOR). Set to:
  • true to use a cache writer to add the value to the cached element and the SOR.
  • false to add the value to the cached element without writing to the SOR. This is the default setting.
Note: If the value already exists in the cache, pub.cache:put replaces the value.

Output Parameters

None.

Usage Notes

If your cache is a distributed cache or is configured to use disk store or BigMemory, key and value must be Java Serializable objects.

If the element with the specified key does not already exist in the cache, the pub.cache:put service puts the element in the cache. If the element with the specified key already exists in the cache, pub.cache:put updates the element with the specified value.

If you run pub.cache:put on a disabled cache, the cache discards the call.

Integration Server issues a ServiceException in the following cases:

  • If you do not specify all required input parameters.
  • If useWriter is set to true and no writer is configured for the cache.
  • If Integration Server cannot find the specified cache manager or cache.
  • If a cache operation fails.

pub.cache:putAll

WmPublic. Populates a collection of elements in the cache with the specified key-value pairs.

Input Parameters

cacheManagerName String Name of the cache manager that manages the cache. This parameter is case sensitive.
cacheName String Name of the cache in which to put the elements. This parameter is case sensitive.
elements Document List An IData[] containing the key-value pairs to put in the cache.
  Key Description
  key Object Key of the cached element.
  value Object Value of the cached element.

Output Parameters

None.

Usage Notes

If your cache is a distributed cache or is configured to use disk store or BigMemory, key and value must be Java Serializable objects.

The key and value input parameters cannot be null. The service might end with a NullPointerException if any key or value parameters are null.

If the element with the specified key does not already exist in the cache, the pub.cache:putAll service puts the element in the cache. If the element with the specified key already exists in the cache, pub.cache:putAll updates the element with the specified value.

If you run pub.cache:putAll on a disabled cache, the cache discards the call.

Integration Server issues a ServiceException in the following cases:

  • If you do not specify all required input parameters.
  • If Integration Server cannot find the specified cache manager or cache.
  • If a cache operation fails.

pub.cache:remove

WmPublic. Removes the cached element associated with the specified key.

Input Parameters

cacheManagerName String Name of the cache manager that manages the cache. This parameter is case sensitive.
cacheName String Name of the cache from which to remove the element. This parameter is case sensitive.
key Object Key of the element to remove.
useWriter String Optional. Indicates whether to use a cache writer to remove the value of the cached element from the system-of-record (SOR). Set to:
  • true to use a cache writer to remove the value from the cached element and the SOR.
  • false to remove the value to the cached element without using a cache writer. This is the default setting.

Output Parameters

removed String Indicates whether the element was removed.
  • true indicates that the element was removed from the cache.
  • false indicates that the element was not removed from the cache.

Usage Notes

If the element associated with the specified key does not exist, pub.cache:remove returns false for removed.

Integration Server issues a ServiceException in the following cases:

  • If you do not specify all required input parameters.
  • If Integration Server cannot find the specified cache manager or cache.
  • If a cache operation fails.

pub.cache:removeAll

WmPublic. Removes the cached elements associated with a list of keys or, if no keys are specified, removes all elements from the cache.

Input Parameters

cacheManagerName String Name of the cache manager that manages the cache. This parameter is case sensitive.
cacheName String Name of the cache in which to put the elements. This parameter is case sensitive.
keys Object List Optional. Keys of the elements to remove from the cache. If you do not specify any keys, the service removes all of the elements from the specified cache.

Output Parameters

None.

Usage Notes

Integration Server issues a ServiceException in the following cases:

  • If you do not specify all required input parameters.
  • If Integration Server cannot find the specified cache manager or cache.
  • If a cache operation fails.

pub.cache:search

WmPublic. Searches through an indexed cache and returns the results. The pub.cache:search service accepts the selection criteria as an IData object and performs the search by converting the IData object to a search query of Terracotta Ehcache.

Note: Before using this service, you must make the cache searchable. For more information about making a cache searchable, see Making a Cache Searchable.

Input Parameters

cacheManagerName String Name of the cache manager that manages the cache. This parameter is case sensitive.
cacheName String Name of the cache from which the search results are to be returned. This parameter is case sensitive.
includeAttributes String Optional. List of attributes that should be included in the search results.
includeKey String Optional. Indicates whether or not the keys should be returned as part of the search results.
  • true indicates that the keys should be returned as part of the search results.
  • false indicates that the keys should not be returned as part of the search results. This is the default.
Note: You should set this parameter to true only if the value is required for your programming logic.
includeValue String Optional. Indicates whether or not the values should be returned as part of the search results.
  • true indicates that the values should be returned as part of the search results.
  • false indicates that the values should not be returned as part of the search results. This is the default.
Note: You should set this parameter to true only if the value is required for your programming logic.
criteria Document A document (IData) that specifies the conditions based on which the data in the cache is to be queried.
  Value Description
  OP1 String or Document A string operand or a nested document type that can be evaluated by a logical operator.
  OPR String A logical (and, or, and not) or comparison operator (between, gt (greater than), eq (equal to), and so on). For a complete list of operators that Integration Server supports as the value for the criteria\OPR parameter, see the Usage Notes for this service.
  OP2 String, Document, Object, or Object List A string operand, nested document type, object, or object list that can be evaluated by a logical operator.
maxResults String Optional. The maximum number of results to return. If maxResults is not specified, Integration Server returns all the results.
groupBy String List Optional. The unique values of specified attributes based on which the search results are to be grouped. The attributes that you specify for grouping the results must be included in the list of attributes specified for the includeAttributes parameter.
orderBy String Table Optional. Whether the service results are to be returned in ascending or descending order.
Values for this parameter must be specified as a two-dimensional string array comprising the field name and whether DESCENDING or ASCENDING (case sensitive) in the following format:
{{"fieldName","order"},{"fieldName","order"}}

Where order is ASCENDING or DESCENDING.

For example, if you have configured name and age as the search attributes for the personCache cache that stores name, age, and address, the orderBy parameter can be specified as shown below:

{{"name","ASCENDING"}}

-or-

{{"name","ASCENDING"},{"age","DESCENDING"}}
aggregator String Table Aggregator function such as average, count, max, min, or sum that you want to be applied on the search results. Values for this parameter should be specified as a two-dimensional string array in the following format:
{{"fieldName","aggregator"}, 
{"fieldName","aggregator"}}

Where aggregator can be average, count, max, min, or sum (case-insensitive).

For example, {{"age","Max"}} or {{"income","Average"}}.

If you want to use the aggregator function, you must:
  • Specify a value for the groupBy parameter.
  • Set the includeKey and includeValue parameters to false.

Output Parameters

result Object List The returned results of the search.

Each object in the result parameter is of type com.wm.app.b2b.client.cache.config.SearchResult. For more information about com.wm.app.b2b.client.cache.config.SearchResult type, see webMethods Integration Server Java API Reference .

Each object contains information about the cache element, key, value, search attribute values, and aggregator results, if any.

Usage Notes

If you want to search a document (IData) in the cache, you must first create an attribute extractor class and identify the search attributes for the cache. Terracotta Ehcache uses the extractor class and the provided search attribute information to search the cache when the pub.cahce:search service executes.

A sample IData that you can specify as the criteria input parameter is given below. The following input searches the personCache cache for entries, where age is greater than 60 and gender is female.

IData idata = IDataFactory.create();
 
//Cache information 
          IDataMap map = new IDataMap(idata)    ; 
          map.put("cacheManagerName", "SearchTestManager")    ; 
          map.put("cacheName", "personCache")    ; 
          map.put("includeKey", "true")    ; 
          map.put("includeValue", "true") ;
//Condition 1 - Age > 60 
          IData input1 = IDataFactory.create()    ; 
          IDataCursor cursor1 = input1.getCursor()    ; 
          IDataUtil.put(cursor1, "OP1", "age")    ; 
          IDataUtil.put(cursor1, "OPR", "gt")    ; 
          IDataUtil.put(cursor1, "OP2", 60) ;
 
//Condition 2 - Gender == Female 
          IData input2 = IDataFactory.create()    ; 
          IDataCursor cursor2= input2.getCursor()    ; 
          IDataUtil.put(cursor2, "OP1", "gender")    ; 
          IDataUtil.put(cursor2, "OPR", "eq")    ; 
          IDataUtil.put(cursor2, "OP2", Person.Gender.FEMALE) ;
 
//Joining conditions, condition 1 && condition 2 
          IData input3 = IDataFactory.create()    ; 
          IDataCursor cursor3 = input3.getCursor()    ; 
          IDataUtil.put(cursor3, "OP1", input1)    ; 
          IDataUtil.put(cursor3, "OPR", "AND")    ; 
          IDataUtil.put(cursor3, "OP2", input2)    ; 
          map.put("criteria", input3) ;
 
//Run the search 
          IData result = invoke(NSName.create("pub.cacheimpl:search"), 
          idata); 
          Object[] objectList = (Object[]) IDataUtil.get(result.getCursor(), 
          "result");
          for (int i = 0; i < objectList.length; i++) { 
          Person value = (Person) ((SearchResult) objectList[i]).getValue(); 
          System.out.println(value.getGender()); 
          System.out.println( value.getAge()); 
        }

When using the between operator for the criteria\OPR parameter, you must specify start and end values. That is, you must specify a two-element Object List with the 0 element as the start value and the first element as the end value. For example:

//Condition  1 < age <10 
      IData input1 = IDataFactory.create() ; 
      IDataCursor cursor1 = input1.getCursor() ; 
      IDataUtil.put(cursor1, "OP1", "age") ; 
      IDataUtil.put(cursor1, "OPR", "between") ; 
      IDataUtil.put(cursor1, "OP2", {1,10}) ;
Integration Server supports the following operators as the value for criteria\OPR parameter:
Operators Description
and AND logical operator
between Comparison between two values.
eq Equals
gt Greater than
ge Greater than or equal to
ilike Regular expression matcher using '?' and "*".
in Comparison operator meaning in the collection given as an argument.
isNull Checks whether the value of an attribute is null.
lt Less than.
le Less than or equal to
not NOT logical operator
ne Not equal to
notNull Checks whether the value of an attribute with given name is NOT null.
or OR logical operator

Because the state of the cache can change between search executions, include all of the aggregators to the search query at the same time, so that the returned aggregators are of the same iteration of the cache.

By default a search will return an unlimited number of results. If too many results are returned, Integration Server might issue an OutOfMemoryError and become unresponsive. Limit the size of the results using the maxResults parameter.

To ensure that Integration Server does not issue an OutOfMemoryError while invoking the service using Designer, do the following:
  1. Copy the ehcache-ee.jar from Software AG_directory/common/lib/ to the Software AG_directory/Designer/eclipse/plugins/com.softwareag.is.runtimejars folder.
  2. Edit the Software AG_directory/Designer/eclipse/plugins/com.softwareag.is.runtimejars/META-INF/MANIFEST.MF file by appending ehcache-ee.jar to the "Bundle-ClassPath:" property. Maintain the characters per line in the MANIFEST.MF file while editing.
  3. Restart Designer using the -clean option:
    
                               
                                  Software AG_directory
                               /Designer/eclipse/ eclipse.exe -clean
    This cleans the folders in the following directory: <workspace_location>\.metadata\.plugins\com.softwareag.is.runtimejars.

pub.cache.admin:clearAllCaches

WmPublic. Deletes all of the elements from all caches contained in the specified cache manager.

Input Parameters

cacheManagerName String Name of the cache manager that manages the cache. This parameter is case sensitive.
cachePrefix String Optional. Prefix of the name of the caches from which to delete elements. If you do not specify a prefix, the service deletes elements from all caches in the cache manager.
Note: If pub.cache.admin:clearAllCaches does not find any caches with the specified prefix, the service does not clear any caches.

Output Parameters

status String The status indicating either Error or Success.
message String The status message.

Usage Notes

Note: Only users with administrator privileges can execute this service.
Important: The elements you delete from the caches are deleted permanently. You cannot undo this action.

If pub.cache.admin:clearAllCaches does not find any caches with the specified prefix, the service does not clear any caches, but returns Success for status.

You cannot clear caches managed by system cache managers.

If you have any existing locks on any of the elements in the cache, the pub.cache.admin:clearAllCaches service waits indefinitely until all locks are released.

Integration Server returns a status of Error in the following cases:

  • If the cache is managed by a system cache manager.
  • If you do not specify all required input parameters.
  • If Integration Server cannot find the specified cache manager.
  • If a cache operation fails.

pub.cache.admin:clearCache

WmPublic. Deletes all elements from the specified cache.

Input Parameters

cacheManagerName String Name of the cache manager that manages the cache. This parameter is case sensitive.
cacheName String Name of the cache from which to delete the elements. This parameter is case sensitive.

Output Parameters

status String The status indicating either Error or Success.
message String The status message.

Usage Notes

Note: Only users with administrator privileges can execute this service.
Important: The elements you delete from the cache are deleted permanently. You cannot undo this action.

You cannot clear caches managed by system cache managers.

If you have any existing locks on any of the elements in the cache, the pub.cache.admin:clearCache service waits indefinitely until all locks are released.

Integration Server returns a status of Error in the following cases:

  • If the cache is managed by a system cache manager.
  • If you do not specify all required input parameters.
  • If Integration Server cannot find the specified cache manager or cache.
  • If a cache operation fails.

pub.cache.admin:disableCache

WmPublic. Disables a cache.

Input Parameters

cacheManagerName String Name of the cache manager that manages the cache. This parameter is case sensitive.
cacheName String Name of the cache to disable. This parameter is case sensitive.

Output Parameters

status String The status indicating either Error or Success.
message String The status message.

Usage Notes

Note: Only users with administrator privileges can execute this service.

When you disable a cache, the cached elements are unavailable for cache operations but still present in the cache. Use the pub.cache.admin:enableCache service to make the disabled cached elements available again.

You cannot disable caches managed by system cache managers.

After the pub.cache.admin:disableCache service disables a cache, other services cannot add, modify, delete, or retrieve its contents. For example, calls to the pub.cache:get service will return null.

The disabled state of a cache lasts only for the lifetime of its cache manager. When the cache manager is restarted, either by restarting Integration Server or clicking the reload icon on the Settings > Caching page in Integration Server Administrator, the cache is enabled.

When you disable a cache, Integration Server:

Integration Server returns a status of Error in the following cases:

  • If the cache is managed by a system cache manager.
  • If you do not specify all required input parameters.
  • If Integration Server cannot find the specified cache manager or cache.
  • If a cache operation fails.

pub.cache.admin:enableCache

WmPublic. Enables a cache.

Input Parameters

cacheManagerName String Name of the cache manager that manages the cache. This parameter is case sensitive.
cacheName String Name of the cache to enable. This parameter is case sensitive.

Output Parameters

status String The status indicating either Error or Success.
message String The status message.

Usage Notes

Note: Only users with administrator privileges can execute this service.

You cannot enable caches managed by system cache managers.

When you disable a cache, the cached elements are unavailable but still present in the cache. Use pub.cache.admin:enableCache to make the cached elements available again.

Integration Server returns a status of Error in the following cases:

  • If the cache is managed by a system cache manager.
  • If you do not specify all required input parameters.
  • If Integration Server cannot find the specified cache manager or cache.
  • If a cache operation fails.

pub.cache.admin:evictExpiredElements

WmPublic. Deletes all of the expired elements from a cache.

Input Parameters

cacheManagerName String Name of the cache manager that manages the cache. This parameter is case sensitive.
cacheName String Name of the cache from which you want to delete the expired elements. This parameter is case sensitive.

Output Parameters

status String The status indicating either Error or Success.
message String The status message.

Usage Notes

Note: Only users with administrator privileges can execute this service.
Important: The elements you delete from the cache are deleted permanently. You cannot undo this action.

The pub.cache.admin:evictExpiredElements service can take longer to delete expired elements depending on the number of elements contained in the cache. If the cache contains a large number of elements, pub.cache.admin:evictExpiredElements might take longer to process the request than when the cache contains fewer elements.

Integration Server returns a status of Error in the following cases:

  • If the cache is managed by a system cache manager.
  • If you do not specify all required input parameters.
  • If Integration Server cannot find the specified cache manager or cache.
  • If a cache operation fails.

pub.cache.admin:isCacheDisabled

WmPublic. Checks whether the cache is disabled.

Input Parameters

cacheManagerName String Name of the cache manager that manages the cache. This parameter is case sensitive.
cacheName String Name of the cache for which you want to check the status (whether it is disabled or enabled). This parameter is case sensitive.

Output Parameters

isDisabled String Indicates whether the cache is disabled. A value of:
  • true indicates that the cache is disabled.
  • false indicates that the cache is enabled.
status String Conditional. The status indicating Error. The service returns Error for status only if the service fails when checking whether the cache is disabled.
message String Conditional. The status message of the error. The service returns message with status only if an error occurs when checking whether the cache is disabled.

Usage Notes

Note: Only users with administrator privileges can execute this service.

pub.cache.admin:isCacheDisabled returns Error for status and an accompanying message in the following cases:

  • If you do not specify all required input parameters.
  • If Integration Server cannot find the specified cache manager or cache.
  • If a cache operation fails.

pub.cache.atomic:putIfAbsent

WmPublic. Adds an element to the cache if the cache does not contain an element with the specified key.

Input Parameters

cacheManagerName String Name of the cache manager that manages the cache. This parameter is case sensitive.
cacheName String Name of the cache to which to add the element. This parameter is case sensitive.
key Object Key of the element.
value Object Value to add to the element.

Output Parameters

keyExists String Indicates whether an element with the specified key exists in the cache.
  • true indicates that an element with the key already exists in the cache.
  • false indicates that an element with the key does not exist in the cache.
oldValue Object Conditional. Value of the element that already exists in the cache. Returned only if keyExists is true.

Usage Notes

The pub.cache.atomic:putIfAbsent service adds the specified value to the cache only if the specified key does not already exist in the cache. If the specified key already exists in the cache, pub.cache.atomic:putIfAbsent returns true for keyExists and the value of the cached element for oldValue.

Integration Server issues a ServiceException in the following cases:

  • If you do not specify all required input parameters.
  • If Integration Server cannot find the specified cache manager or cache.
  • If a cache operation fails.

pub.cache.atomic:remove

WmPublic. Removes the cached element associated with the specified key and value.

Input Parameters

cacheManagerName String Name of the cache manager that manages the cache. This parameter is case sensitive.
cacheName String Name of the cache from which to remove the element. This parameter is case sensitive.
key Object Key of the element to remove.
value Object Value of the element to remove.

Output Parameters

removed String Indicates whether the service removed the element.
  • true indicates that the element was removed from the cache.
  • false indicates that the element was not removed from the cache. The service returns false if the specified key and value do not exist in the cache.

Usage Notes

Integration Server issues a ServiceException in the following cases:

  • If you do not specify all required input parameters.
  • If Integration Server cannot find the specified cache manager or cache.
  • If a cache operation fails.

pub.cache.atomic:replace

WmPublic. Replaces the cached element value with the supplied value.

Input Parameters

cacheManagerName String Name of the cache manager that manages the cache. This parameter is case sensitive.
cacheName String Name of the cache that contains the value you want to replace. This parameter is case sensitive.
key Object Key of the cache element whose value you want to replace.
oldValue Object Value of the cached element.
newValue Object Value with which to replace the value of the cached element.

Output Parameters

replaced String Indicates whether the service replaced oldValue with newValue in the cache.
  • true indicates that the value was replaced in the cache.
  • false indicates that the value was not replaced in the cache.

Usage Notes

The pub.cache.atomic:replace service replaces an element in the cache only if an element with the values of the specified key and oldValue parameters already exist in the cache. If an element exist in the cache with the specified key and oldValue, pub.cache.atomic:replace replaces the cached element with the specified key and newValue.

Integration Server issues a ServiceException in the following cases:

  • If you do not specify all required input parameters.
  • If Integration Server cannot find the specified cache manager or cache.
  • If a cache operation fails.

pub.cache.atomic:replaceIfKeyExists

WmPublic. Replaces the cached element if an element for the specified key exists in a cache.

Input Parameters

cacheManagerName String Name of the cache manager that manages the cache. This parameter is case sensitive.
cacheName String Name of the cache that contains the key. This parameter is case sensitive.
key Object Key of the element whose value you want to replace.
value Object Value with which to replace the value of the cached element.

Output Parameters

keyExists String Indicates whether the element with the passed key exists in the cache.
  • true indicates that the element with the key already exists in the cache.
  • false indicates that the element with the key does not exist in the cache.
oldValue Object Conditional. Value of the element the service replaced with value. Returned only if keyExists is true.

Usage Notes

The pub.cache.atomic:replaceIfKeyExists service replaces an element in the cache only if the specified key already exists in the cache. If an element with the specified key exists, pub.cache.atomic:replaceIfKeyExists replaces value of the cached element with the one specified in value.

Integration Server issues a ServiceException in the following cases:

  • If you do not specify all required input parameters.
  • If Integration Server cannot find the specified cache manager or cache.
  • If a cache operation fails.

pub.cache.bulk:isClusterBulkLoadEnabled

WmPublic. Checks whether the cache on at least one Integration Server node in the Terracotta Server Array cluster is enabled for bulk loading.

Input Parameters

cacheManagerName String Name of the cache manager that manages the cache. This parameter is case sensitive.
cacheName String Name of the cache to check for bulk loading. This parameter is case sensitive.

Output Parameters

enabled String Indicates whether the cache on at least one Integration Server node of the Terracotta Server Array cluster is in bulk-load mode.
  • true indicates that at least one node is in bulk-load mode.
  • false indicates that the node is not in bulk-load mode.

Usage Notes

The pub.cache.bulk:isClusterBulkLoadEnabled service applies only to distributed caches. If you run pub.cache.bulk:isClusterBulkLoadEnabled on a local cache, the service returns false for enabled.

Integration Server issues a ServiceException in the following cases:

  • If you do not specify all required input parameters.
  • If Integration Server cannot find the specified cache manager or cache.
  • If a cache operation fails.

pub.cache.bulk:isNodeBulkLoadEnabled

WmPublic. Checks whether the cache of the current Integration Server node in the Terracotta Server Array cluster is bulk-load enabled.

Input Parameters

cacheManagerName String Name of the cache manager that manages the cache. This parameter is case sensitive.
cacheName String Name of the distributed cache to check for bulk loading. This parameter is case sensitive.

Output Parameters

enabled String Indicates whether the cache is enabled for bulk loading.
  • true indicates that the Integration Server node calling the service is the same one that enabled bulk-loading.
  • false indicates one of the following:
    • The Integration Server node calling the service was not the same node that enabled bulk loading.
    • The specified cache is a local cache.

Usage Notes

The pub.cache.bulk:isNodeBulkLoadEnabled service applies only to distributed caches.

Integration Server issues a ServiceException in the following cases:

  • If you do not specify all required input parameters.
  • If Integration Server cannot find the specified cache manager or cache.
  • If a cache operation fails.

pub.cache.bulk:setNodeBulkLoadEnabled

WmPublic. Enables or disables bulk loading mode in the current Integration Server node for the cache.

Input Parameters

cacheManagerName String Name of the cache manager that manages the cache. This parameter is case sensitive.
cacheName String Name of the cache on which to enable or disable bulk loading. This parameter is case sensitive.
bulkMode String Indicates whether to enable the bulk-load mode for the cache. Set to:
  • true to enable the bulk-load mode. This is the default.
  • false to disable the bulk-load mode.

Output Parameters

None.

Usage Notes

The pub.cache.bulk:setNodeBulkLoadEnabled service applies only to distributed caches.

The pub.cache.bulk:setNodeBulkLoadEnabled service does nothing if you:

  • Try to enable bulk loading (bulkMode set to true) when the node is already in bulk-load mode.
  • Try to disable bulk loading (bulkMode set to false) when the node is not already in bulk-load mode.

Integration Server issues a ServiceException in the following cases:

  • If you do not specify all required input parameters.
  • If Integration Server cannot find the specified cache manager or cache.
  • If a cache operation fails.

pub.cache.bulk:waitUntilClusterBulkLoadComplete

WmPublic. Indicates whether Integration Server delays execution of the next step in a flow service until all of the Integration Server nodes in the Terracotta Server Array cluster disable bulk loading for the cache.

Input Parameters

cacheManagerName String Name of the cache manager that manages the cache. This parameter is case sensitive.
cacheName String Name of the cache on which to hold processing. This parameter is case sensitive.

Output Parameters

None.

Usage Notes

The pub.cache.bulk:waitUntilClusterBulkLoadComplete service applies only to distributed caches.

If none of the nodes are bulk-load enabled, Integration Server immediately executes the next step in the flow service without waiting.

Integration Server issues a ServiceException in the following cases:

  • If you do not specify all required input parameters.
  • If Integration Server cannot find the specified cache manager or cache.
  • If a cache operation fails.

pub.cache.lock:acquireLock

WmPublic. Acquires a lock on the cached element that contains the specified key.

Input Parameters

cacheManagerName String Name of the cache manager that manages the cache. This parameter is case sensitive.
cacheName String Name of the cache that contains the element to lock. This parameter is case sensitive.
key Object Key of the cached element to lock.
lockType String Optional. Type of lock you want to place on the cached element.
Key Description
read Places a read lock on the key. This is the default.
write Places a write lock on the key.
lockWaitTime String Optional. Amount of time in milliseconds to wait to acquire a lock before timing out.
Key Description
Any integer less than 0 The service waits indefinitely until it acquires a lock.
0 The service fails if it is unable to acquire the lock immediately. This is the default.
Any integer greater than 0 The service fails if it is unable to acquire the lock within the specified time.

Output Parameters

None.

Usage Notes

If the pub.cache.lock:acquireLock service acquires a lock, the element remains locked until released with the pub.cache.lock:releaseLock service.

You must acquire and release a lock in the same thread in which pub.cache.lock:acquireLock is executing. Failing to do so could cause the key to remain locked indefinitely.

When using the debug flow service to step through a flow service, depending on your breakpoint settings Designer might use a new thread for each step. You cannot release a lock acquired in a previous step of the same flow if break points are triggered on Designer or if you are stepping through a flow service. To avoid orphaned locks, disable invocations of pub.cache.lock:acquireLock and pub.cache.lock:releaseLock before stepping through the flow service or make sure that pub.cache.lock:acquireLock and pub.cache.lock:releaseLock services are called between the boundaries of two breakpoints.

Integration Server issues a ServiceException in the following cases:

  • If you do not specify all required input parameters.
  • Whether or not a cached element needs to be locked depends on the application that is using the element. For example, if an application retrieves and holds an element for a time and needs to prevent another client from changing the element during this time, the application should acquire a lock on the element. However, if the application does not hold the element, a lock might not be required.
  • If Integration Server cannot find the specified cache manager or cache.
  • If pub.cache.lock:acquireLock is unable to acquire a lock.
  • If the specified lockWaitTime is not a valid integer.
  • If a cache operation fails.

pub.cache.lock:isLockedByCurrentThread

WmPublic. Checks whether the current thread is holding a lock on the cached element for the specified key.

Input Parameters

cacheManagerName String Name of the cache manager that manages the cache. This parameter is case sensitive.
cacheName String Name of the cache that contains the key. This parameter is case sensitive.
key Object Key for which you want to check locks.
lockType String Optional. Type of lock for which to check the cached element.
Key Description
read The service checks whether the read lock is held for the current thread. This is the default.
write The service checks whether the write lock is held for the current thread.

Output Parameters

locked String Indicates whether the cached element is locked by the current thread.
  • true indicates that the element is locked.
  • false indicates that the element is not locked.
    Note: If the specified cache is a local cache and the specified lockType is read, the service always returns false.

Usage Notes

Integration Server issues a ServiceException in the following cases:

  • If you do not specify all required input parameters.
  • If Integration Server cannot find the specified cache manager or cache.

pub.cache.lock:releaseLock

WmPublic. Releases a lock on the element for the specified key.

Input Parameters

cacheManagerName String Name of the cache manager that manages the cache. This parameter is case sensitive.
cacheName String Name of the cache that contains the key. This parameter is case sensitive.
key Object Key of the cached element to unlock.
lockType String Optional. Type of lock you want to release from the cached element.
Key Description
read Releases a read lock. This is the default.
write Releases a write lock.

Output Parameters

None.

Usage Notes

You must call pub.cache.lock:releaseLock from the same thread from which you call pub.cache.lock:acquireLock. Failing to do so could cause the key to remain locked indefinitely.

Integration Server issues a ServiceException in the following cases:

  • If you do not specify all required input parameters.
  • If Integration Server cannot find the specified cache manager or cache.
  • If you try to release a read lock on a cached element for which a write lock is set, or release a write lock on a cached element for which a read lock is set.

pub.cache.serviceResults:addCacheEntry

WmPublic. Adds cached entry into service results for the service without executing the actual service. This service can be useful to perform bulk load of service results at Integration Server startup.

Input Parameters

serviceName String Name of the service for which to add the cache entry into cached service results.
input Document An IData containing the key/value pairs for the cached service input.
output Document An IData containing the key/value pairs for the cached service output.

Output Parameters

None.

Usage Notes

If the serviceName service does not exist in Integration Server, or it is not enabled to cache service results, Integration Server throws an exception.

pub.cache.serviceResults:listServiceCache

WmPublic. Returns a list of the cached service results for a particular service.

Input Parameters

serviceName String Name of the service for which you want to view the cached service results.

Output Parameters

elements Document List Conditional. A document list (IData []) containing the cached service results for the specified service. The pub.cache.serviceResults:listServiceCache service returns the elements output only if the service results cache contains cached results for the specified service. For each set of cached service results, the pub.cache.serviceResults:listServiceCache returns the following information:
  Key Description
  key String Optional. Key for the cached element containing the service results.
  input Document Optional. An IData containing the key/value pairs for the cached service input.
  output Document Optional. An IData containing the key/value pairs for the cached service output.

Usage Notes

If serviceName specifies a service that does not exist or a service for which Integration Server does not cache service results, Integration Server returns an empty elements output parameter.-

You can use the pub.cache.serviceResults:listServiceCache with a public service results cache only. You cannot use the pub.cache.serviceResults:listServiceCache with the ServiceResults system cache.

For the pub.cache.serviceResults:listServiceCache service to return results, make sure that the service results cache is searchable and that the cache allows automatic indexing for keys. That is, for the service results cache, the Searchable check box must be selected and the Key check box next to Allow Automatic Indexing must be selected.

Exposing the contents of the service results cache via the pub.cache.serviceResults:listServiceCache may represent a security risk.

pub.cache.serviceResults:resetServerCache

WmPublic. Resets the cache for all services in the service results cache, resulting in the removal of all cached service results for all services from the service results cache.

Input Parameters

None.

Output Parameters

message String Message indicating whether Integration Server cleared the entire service results cache successfully. If it did not, review the server and error logs to determine the reason.

pub.cache.serviceResults:resetServiceCache

WmPublic. Resets the cache for specific service, resulting in the removal of cached service results for the service.

Input Parameters

serviceName String Fully qualified name of the service in the format folder.subfolder:serviceName for which you want to remove cached service results.
input Document Optional. An IData containing key/value pairs that indicate the cached elements to remove.

Output Parameters

message String Message indicating whether or Integration Server cleared the service results cache for the specified service successfully. If it did not, review the server and error logs to determine the reason.
Note: If serviceName specifies a service that does not exist, or no cached entry with the specified input exists, the message output parameter returns the message “Cache reset successfully,” to avoid revealing whether a service exists.