# How can I clear the cache?

**URL:** <https://community.embeddable.com/t/how-can-i-clear-the-cache/80>\
**Category:** FAQs\
**Created:** [December 9, 2024, 12:50pm UTC](https://community.embeddable.com/t/how-can-i-clear-the-cache/80 "2024-12-09T12:50:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ella-embeddable](https://dub1.discourse-cdn.com/flex013/user_avatar/community.embeddable.com/ella-embeddable/32/15_2.png) [@ella-embeddable](https://community.embeddable.com/u/ella-embeddable)\
**Post date:** [December 9, 2024, 12:50pm UTC](https://community.embeddable.com/t/how-can-i-clear-the-cache/80/1 "2024-12-09T12:50:52Z")

</div>

If you have a scenario where you want to invalidate the cache you can:

- click publish
- call our cache API

Both of those actions will instantly cause the cache to refresh.

You can also have the cache clear programatically:

If you are using our L1 cache - i.e. using scheduled caching with refreshKey, you can set your cache to refresh if there are new results:

- [Cube example here](https://cube.dev/docs/product/caching#refresh-keys)

If you are using our pre-aggregations cache (L2 cache) you can also do something similar, where if the results of the SQL refresh key differ from the last execution, then the pre-aggregation will be refreshed:

- [Cube example here](https://cube.dev/docs/reference/data-model/pre-aggregations#sql)
