Clear or evict all cache Programmatically.
Does Java provide something which can clear all the cache at once?👆👆👆👆❓❓❓
The answer is NO 👎👎👎😕😕😕.
Java does not provide any such feature which can clear all the cache at once.👍👍👍👍
So how do clear all the 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
Find the code below 👇👇👇👍
@Controller @CrossOrigin("*") @RequestMapping("javaoneworld") public class JavaOneWorldController { /* autowire cache manager */ @Autowired private CacheManager cacheManager; /* clear all cache using cache manager */ @RequestMapping(path = "/clearCache") public ResponseEntity<String> clearCache(){ if(cacheManager.getCacheNames().isEmpty()) { return ResponseEntity.status(HttpStatus.NOT_FOUND).body("No cache record has been found"); }else { for(String name:cacheManager.getCacheNames()){ /* printing cache name */ System.out.println(name); /* clear cache by name */ cacheManager.getCache(name).clear(); } return ResponseEntity.status(HttpStatus.OK).body("All cache has been cleared"); } } }
Find another must-read post.
Thanks a bunch for being here.
#stayhealthy
#takeCare
Thankyou for the information given here and I want some data about clear cache google chrome
ReplyDeletekars
ReplyDeletesinop
sakarya
ankara
çorum
Q1PN
görüntülü show
ReplyDeleteücretlishow
PZ3
0BC38
ReplyDeleteBingöl Parça Eşya Taşıma
Kütahya Evden Eve Nakliyat
Van Parça Eşya Taşıma
Konya Lojistik
Tunceli Lojistik
E0E5E
ReplyDeleteBayburt Lojistik
Balıkesir Parça Eşya Taşıma
Bursa Şehirler Arası Nakliyat
Maraş Şehirler Arası Nakliyat
Ankara Parke Ustası
Kırşehir Şehirler Arası Nakliyat
Kars Parça Eşya Taşıma
Batman Şehirler Arası Nakliyat
Ordu Lojistik
1D80F
ReplyDeleteclenbuterol
sustanon for sale
order turinabol
buy primobolan
steroids for sale
winstrol stanozolol
boldenone
clenbuterol for sale
sarms
F1F7A
ReplyDeleteKucoin Güvenilir mi
Adana Şehirler Arası Nakliyat
İzmir Şehir İçi Nakliyat
Muş Lojistik
Pancakeswap Güvenilir mi
Ağrı Şehirler Arası Nakliyat
Çorum Şehirler Arası Nakliyat
Hatay Lojistik
Ünye Oto Elektrik
A384B
ReplyDeleteÇerkezköy Ekspertiz
Yenimahalle Boya Ustası
Çerkezköy Halı Yıkama
Silivri Parke Ustası
Adana Şehirler Arası Nakliyat
Antalya Lojistik
Çerkezköy Oto Elektrik
Samsun Lojistik
Ünye Çatı Ustası
332D6
ReplyDeletebinance %20 referans kodu
38463
ReplyDelete%20 indirim kodu