0

I want to get data from DB and store into cache on startup using caffeine cache. Whenever i want that data i need to fetch it from cache itself without calling DAO class

I'm new to cache.

James Z
  • 12,209
  • 10
  • 24
  • 44
ulagan
  • 21
  • 3
  • See https://stackoverflow.com/questions/27940704/how-to-load-cache-on-startup-in-spring – Evgeni Dimitrov Mar 31 '18 at 14:40
  • Hi Evgeni Dimitrov, Thanks valuable response. Now I'm able call @Cachable on startup. Now I have one more doubt! For retrieving cached values I'm using below function. Is this proper way? Sample code for Retrieve ` private Map> getDataFromCache (){ Map> cachedData = new HashMap>(); ValueWrapper valueMapper = cm.getCache("SAMPLE_CACHE").get("Directories"); System.out.println(valueMapper.get()); return cachedData; }` – ulagan Apr 01 '18 at 18:30

0 Answers0