I am building the application in Mule 4 to cache the response from http request component (for 1 hours). I use the response to validate the jwt. Whenever there is a failure, I need to clear the cache and re-invoke the http request. Component used is : Cache Scope
My Current Code looks like below:-
<ee:object-store-caching-strategy name="Caching_Strategy" doc:name="Caching Strategy" doc:id="50e44473-b55a-4bc3-b53a-18e4229a31a3" keyGenerationExpression="#['token']" >
<os:private-object-store persistent="false" maxEntries="${caching.maxEntries}" entryTtl="${caching.entryTtl}" expirationInterval="${caching.expirationInterval}" />
</ee:object-store-caching-strategy>
I don't have any specific requirement to make it private object store but disabling it does not allow me to configure the maxEntries, entryTTL and Expiration Interval.
It would be more helpful if you could guide me the ways to
I have already tried the exchanges examples for configure the cache ( but there is no mention of clear the cache).
I am using Mule Runtime 4.2.2 and On Prem Mule
I have raised a support ticket with Mulesoft and received the below replies
1) Invalidate Cache is shown only in the palette from the Anypoint Studio Version 7.4.1. Not shown in earlier version of studio.( I was using 7.3.2)
2) They are adding the documentation for the invalidate cache in Mule 4.
3) Usage Note : Cache Scope and the 'Invalidate Cache' processor should share the same Caching_Strategy).
4) In order to explicitly define object store and ttl for a Cache Scope, please ensure object store related modules are added to the project. This can be done by simply adding a 'Store' processor in your mule flow, this will add all necessary modules to your mule application. Then, on the Caching Strategy, General > Reference > Object Store, you can select Edit Inline and define your object store with explicit settings such as - Max entries - Entry ttl - Expiration interval You can remove the unused 'Store' processor as well.
Hope it helps others