DEV Community

JavaOneWorld
JavaOneWorld

Posted on

How to clear cache in SpringBoot java??

how do clear all the internal stored cache?😞😞😞
Java does not have any direct method which can clear all the internally stored cache.
We have a solution which we can use to achieve this,πŸ˜€πŸ˜„βœŒπŸ‘Œ

CacheManager class has a method name getCacheNames() returns the name of the cache, and after that we use clear() to clear that cache.

we use this method to achieve our goal to clear all the cache.

CacheManager.getCacheNames().

CacheManager.getCache(cacheName).clear

https://www.javaoneworld.com/2021/06/how-to-clear-cache-in-springboot-java.html

java

SpringBoot

Code

clearcache

Top comments (1)

Collapse
 
sloan profile image
Sloan the DEV Moderator β€’

Hi there, we encourage authors to share their entire posts here on DEV, rather than mostly pointing to an external link. Doing so helps ensure that readers don’t have to jump around to too many different pages, and it helps focus the conversation right here in the comments section.

If you choose to do so, you also have the option to add a canonical URL directly to your post.

Postmark Image

Speedy emails, satisfied customers

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

πŸ‘‹ Kindness is contagious

Please leave a ❀️ or a friendly comment on this post if you found it helpful!

Okay