Oracle Service Bus 11g provides built-in cache functionality
that utilizes Oracle Coherence, support for many caching strategies.
Oracle Coherence
Integration:-
Oracle Service Bus always had some mechanics of caching in
order to provide XQuery and XML beans caching, in addition to object caching
for Proxy and Business Services classes. But from 11g Release 1 onward, Oracle
Service Bus offered an integrated solution for result caching with Oracle
Coherence.
The result caching in Oracle Service Bus is available for
Business Services. When you enable result caching, the Business Service will
not reach the backend service and the response will come from the cache entry.
This entry can expire and if the entry is expired, the next service call will
indeed reach the backend service and update the cache entry.
Activating Cache for Business Service
To enable result caching
for our Business Service follow these steps: Open any business service
This will use the customer ID as our unique token for the
cache entry. Also, set the Expiration Time for 10 minutes.
Click Last >> and Save to confirm the Business Service
modifications. You can activate the change session.
Now test the proxy service
Now the result will show the results immediately, directly
from a cache entry in the embedded Oracle Coherence Server running within
Oracle Service Bus. The cache Expiration
Time (Time-to-Live) is set to 10 mins, so during this period your calls will
not hit the backend Web service.
More complex cache tokens :-
Your desired cache token key may not be as straight forward
as selecting the contents of a single, predictably placed node.
It is worth noting
that the Cache Token may be specified as any expression you like, using the
XQuery functional programming language.
XQuery has a rich
syntax for constructing queries, including the use of many system libraries
with common functions such as numeric operations and string manipulation.
Clear the cache explicitly:-
It might be that you can’t risk the cache becoming stale
under certain circumstances. If that is the case, rather than using a time
parameter to manage the lifetime of the cached responses, mark critical
requests with an additional flag and select XQuery Expression in the expiration
time options to test for the existence of this flag.