---
schema_version: "1"
id: 30c0d39616312d4fcce2ab2120b71da8583d9dfe05fc212b4bfdb08a81c1d6c7
title: Invalidate Cache (<ee:invalidate-cache/>)
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/anypoint-code-builder/acb-component-invalidate-cache.md
canonical_url: https://docs.mulesoft.com/anypoint-code-builder/acb-component-invalidate-cache
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 8b5502f060a64031861dd39f55f7a2f1267fb3af93cbcc1fd1922c8f989e6418
description: MuleSoft Documentation Site
latest: true
---
---
product: Anypoint Code Builder
version: master
---

# Invalidate Cache (<ee:invalidate-cache/>)

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

Invalidate the complete cache in the referenced caching strategy.

Invalidate cache entries when you want the Cache Scope to recalculate the value for those cache
entries. Alternatively, you can configure the caching strategy to invalidate entries automatically
based on time by setting the `entryTtl` parameter in the defined custom object store.

## Component XML

This component supports the following XML structure:

```xml
<ee:invalidate-cache
  cachingStrategy-ref=""
  doc:name="Invalidate cache"
  doc:id="kacopu" />
```

Invalidate Cache (`<ee:invalidate-cache/>`) attributes are configurable through the UI and XML.

<table><colgroup><col> <col> <col></colgroup><thead><tr><th>Attribute Name</th><th>Attribute XML</th><th>Description</th></tr></thead><tbody><tr><td><p><strong>Invalidate cache</strong> (default)</p></td><td><p><code>doc:name</code></p></td><td><div><div><p>Editable name for the component to display in the canvas.</p></div></div></td></tr><tr><td><p>N/A</p></td><td><p><code>doc:id</code></p></td><td><div><div><p>Automatically generated identifier for the component.</p></div></div></td></tr><tr><td><p><strong>Cachingstrategy ref</strong></p></td><td><p><code>cachingStrategy-ref</code></p></td><td><div><div><p>Reference to the caching strategy for the cache to invalidate.</p></div></div></td></tr></tbody></table>

## Examples

The following examples show how to manually invalidate a cache and how to set automatic invalidation
for a caching strategy.

### Example: Invalidating a Cache

The following example invalidates the complete cache in the referenced caching strategy.

```xml
<!-- Caching strategy configuration -->
<ee:object-store-caching-strategy name="myCachingStrategy" />

<flow name="cacheFlow">
  <ee:cache cachingStrategy-ref="myCachingStrategy">
      <!-- Processing logic inside the Cache Scope -->
  </ee:cache>
</flow>

<flow name="invalidateCompleteCacheFlow">
  <!-- Invalidate Cache component configuration -->
  <ee:invalidate-cache cachingStrategy-ref="myCachingStrategy" />
</flow>
```

### Example: Setting Automatic Invalidation for a Caching Strategy

The following example configures a caching strategy with a custom object store that automatically
invalidate cache entries.

```xml
<!-- Object Store configuration-->
<os:config name="ObjectStore_Config"/>
<!-- Caching Strategy configuration-->
<ee:object-store-caching-strategy name="Caching_Strategy">
  <!-- Object Store defined for the caching strategy -->
  <os:private-object-store
    alias="CachingStrategy_ObjectStore"
    maxEntries="100"
    entryTtl="10"
    expirationInterval="5"
    config-ref="ObjectStore_Config"/>
</ee:object-store-caching-strategy>
```

## See Also

- [Object Store Configuration](https://docs.mulesoft.com/mule-runtime/latest/mule-object-stores#object-store-config)

- [Invalidate Key](https://docs.mulesoft.com/anypoint-code-builder/acb-component-invalidate-key)
