Runtime components : Core components : Operations : Tasks : Extending operation cache
  
Extending operation cache
Methods of operation cache
UDTT Operation provides the following methods to operation cache:
getScope
Extracts the scope information configured in UDTT Operation editor or Flow editor.
getCacheExpires
Extracts the expiration time of cache configured in UDTT Operation editor or Flow editor.
Methods of CacheObject
UDTT operation cache provides the operation cache data to UDTT flow through CacheObject. CacheObject includes the following methods:
setContext
SetContext saves the operation contexts that need to be cached.
getCacheExpires
UDTT flow extracts the operation contexts that are saved by getContext.
setCreateTime
SetCreateTime records the time that the operation contexts are cached.
getCreateTime
GetCreateTime extracts the time that the operation contexts are cached.
isExpired
UDTT flow checks that the operation contexts are expired by isExpired.
Update
UDTT flow updates the operation contexts that are cached into the current flow by Update.
Extending the operation cache
Extend ScopeManager
1 Create a java class in com.ibm.btt.cache.ScopeManager.
This graphic is described in the surrounding text.
2 Extend or override the following cache methods in ScopeManager.
 
Name
Description
Parameters provided
Content returned
doCache
UDTT determines whether the current operation can use the cache according to the returned value (Boolean) of doCache. If the returned value is true, the toolkit extracts operation results that are saved in cache by getCache or saves the operation results by putCache.
DoCache provides the following parameters:
BTTOperation: JAM provides a set of default scopes, including Flow Scope, Session Scope, and Application Scope. You can create scope class in ScopeManager.
DoCache doesn’t need to return any content.
getCache
If the returned value of doCache is true, the toolkit extracts operation results that are saved in cache by geCache. If the returned value of getCache is null, no cache is for the current operation results or the corresponding cache is expired.
GetCache provides the following parameters:
Processor: indicates the flow that is being implemented.
BTTOperation: indicates the operation that is going to be called.
GetCache needs to return the following content:
CacheObject: provides operation results that are saved in cache.
putCache
If the returned value of doCache is true and the toolkit does not extract available cache by getCache, the toolkit saves the operation results by putCache after it calls the operation.
PutCache provides the following parameters:
Processor: indicates the flow that is being implemented.
BTTOperation: indicates the operation that is going to be called.
OperationRepliedEvent: indicates the events that are fired in current operation. If UDTT calls the operation results that are saved in cache, you can use OperationRepliedEvent to recover the events that are fired in operation.
PutCache doesn’t need to return any content.
This graphic is described in the surrounding text.
Register the newly added ScopeManager in btt.xml.
1 Open btt.xml in UDTT.
This graphic is described in the surrounding text.
2 Add the following content in the setting of btt.xml.
<field id="ScopeManager" value="com.ibm.btt.cache.custom.ScopeManagerCustomization"/>
This graphic is described in the surrounding text.
3 If you need to use the defined scope in operation, type 'custom' in the Scope.
This graphic is described in the surrounding text.
Go up to
Tasks