I would like to cache data in my Spring MVC web application. Since I'm new to Spring and MVC architecture, I would like to ask if data should be cached (via Spring Caching System ) at the DAO level or should I cache service-level output methods?
eg. I have this method at the service level:
@Override
public LinkedList<OrderCount> getOrderCount(Date dateFrom, Date dateTo, Class type) {
try {
return chartDataDAO.getOrderCount(dateFrom, dateTo, type);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
and this method calls this DAO method:
public LinkedList<OrderCount> getOrderCount(Date dateFrom, Date dateTo, Class type);
My question is: do caching on the service or at the DAO level?
source
share