I'm trying to call @CacheEvict and @Cacheable annotation on a single method.
@CacheEvict(value = "tripDetailsDashboardCache", key = "#userId")
@Cacheable(value ="tripDetailsDashboardCache", key="#userId")
public List<DashBoardObject> getAllDetailsForDashBoard(Integer userId){
List<Master> masters = tripDetailsService.getTripDetailsForCaching(userId);
List<DashBoardObject> dashBoardObject = tripDetailsService.getMasterDetailsForDashBoard(userId, masters);
return dashBoardObject;
}
On call of @CacheEvict, I want to delete the cached data for the particular key and again i want to cache the fresh data of the method response. But it is not caching the fresh data ?. And also it is not giving any error ?.