Cache Return
You can use the Cache Return transform to return values after a successful Cache transform.
Overview
Include a Cache Return transform in your Cache Put, Cache Get, or Cache Remove transform group to specify a nested mapping that is called if the Cache transform completes successfully.
A Cache Return transform does not perform any transformation. The Cache Return nested mapping provides predefined input elements that provide data from the successful cache operation. You can also map elements from the input tree to the Cache Return transform and connect the Cache Return transform to one or more output elements. You can then use the nested map to create or transform values and map them to the output elements that you connected to the Cache Return transform.
The
predefined Value input element in the Cache Return nested mapping
has a default schema type of xs:anySimpleType
. If
you know the type of the Java™ object
in the cache, you can map directly to a target element that has the
schema type that matches the Java Object
type; see Schema types that are returned for each supported Java Object type.
If the entry
in the cache might have one of several Java Object
types, you can apply mapping casts to the predefined Value input element.
You can apply mapping casts for the schema types that match each of
the Java Object types; see Casting elements in a message map. Alternatively, you can use an xs:type
transform
to cast the predefined Value input element; see Cast type (xs:type). For example, if the Java Object type of the cache entry might be java.lang.Integer
or java.lang.String
,
you would apply a mapping cast for a schema type of xs:int
,
and a mapping cast for a schema type of xs:string
.
Predefined elements
The Cache Return nested mapping has a number of predefined input elements that vary depending on the associated Cache transform. The following table describes the predefined input elements that are included with each Cache transform:
Element | Cache transforms in which element in included | Description |
---|---|---|
Value | Cache Get Cache Remove |
The value from the key-value pair that is associated with
the key that is mapped to the Cache transform. For information
about the schema type that is returned for each type of Java object in the cache, see Schema types that are returned for each supported Java Object type. Note: At run time, the Value element
does not exist in the following situations:
You can test for the existence of the Value element
by using the XPath expression |
Count | Cache Put | The number of entries added to the global cache or removed from the global cache. |