开发者

How to cache items which are returned by a list query? Using EHCache?

开发者 https://www.devze.com 2023-03-14 13:58 出处:网络
i am successfully able to cache results for queries that retrieve a single value. @Cacheable(cacheName = \"resourceCache\")

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?

0

精彩评论

暂无评论...
验证码 换一张
取 消