Cache Scope in Mule 4

What is Cache Scope ?

Cache is the temporary storage which limits same request processing again.

Create a new mule project and add cache scope from mule palatte

  • Configure the cache scope as below. In the caching strategy, choose reference to strategy. This will ensure that your data is cached in your defined object store instead of in memory.

Select key expression and provide key against which we want to save the result

Configure Object Store

When we hit the request first time it takes 572 ms.

When we trigger the same request second time it only takes 46 ms as it uses cache scope.