How to cache items which are returned by a list query? Using EHCache?
i am successfully able to cache results for queries that retrieve a single value.
@Cacheable(cacheName = "resourceCache")
public Resource find(int id) throws ResourceNotFoundException{
...
}
But for effiency reasons i need to implemented a method that effectively queries the database to retrieve a list of resources and look into the cache i开发者_C百科f possible elements already exist and if not put these in the cache.
How could i implement this? Any suggestions, hints or tips are appreciated?
精彩评论