It's been a while since I tried to do this, but I'm assuming you need to be caching this not in Wink but in whatever HTTP/servlet container you're using. So by caching in the container, you're avoiding a lot of the URI targeting/resource instantiation work. It's possible some of this caching capability has been built into Wink since last I looked, but I didn't remember it being there.
I'm admittedly not the best at remembering the nuance of the various HTTP caching headers, but if you use the JAX-RS apis to set the appropriate lifetime for the resource, it's possible your container (or a proxy sitting in front of Wink) would see that and know what to do with it. Just a thought... -Nick ________________________________ From: zhangpp <[email protected]> To: wink-user <[email protected]> Sent: Tuesday, November 22, 2011 8:08 AM Subject: Re: Re: How can I cache the result? Thanks for replay. But I konw the principle of cache,and I konw I can use Ehcache or memcached. I want to use memcached. @GET @Path("/bookCategory") @Produces(MediaType.APPLICATION_XML) public List<EBookCategory> bookCategory() { //here I can add cache code List<EBookCategory> categorys=getFromCache()==null?getFromDb():getFromCache(); return categorys; } this way I just cache the result from db,and I still waste my cpu on parse the object to xml,I want to cache the xml,but this is done by the wink. How can I cache the result generate by wink? 2011-11-22 ________________________________ zhangpp ________________________________ 发件人: Serafin Sedano 发送时间: 2011-11-22 21:57:07 收件人: wink-user 抄送: 主题: Re: How can I cache the result? Hi, Take a look at Ehcache http://ehcache.org/documentation/user-guide/web-caching Regards. Serafín. 2011/11/22 zhangpp <[email protected]> >Hi everybody! > >I want to add cache function to the web services.It's my code > >@GET >@Path("/bookCategory") >@Produces(MediaType.APPLICATION_XML) >public List<EBookCategory> bookCategory() { >List<EBookCategory> categorys=...get from db; >return categorys; >} > >but I don't want just cache the db result,I want to cache the final >result(the xml generate by wink),how can I do it? > >I'm using memcached and Simple-Spring-Memcached to do it. > >thanks! > > >2011-11-22 >________________________________ > >zhangpp -- Serafín Sedano | Software Engineer | Abiquo | | [email protected]
