A开发者_运维知识库ny clues on how to do it ?
You have two options, you can use either / or both.
1) Cache the call at the web service. You need to ensure that the cache is indexed against the exact parameters used so you don't send back "the wrong answer" to a request.
For example "http://webservice/GetSomething/983" should only cache the result of "GetSomething" where the id parameter is 983. If another request for 983 comes in, you can use your cache, otherwise you'll make a new request.
2) Cache the response at the client. Be careful about doing this with large volumes of data as you'll start consuming too much memory. Essentially, you create a JavaScript cache for the response data - you'll still need to bear in mind the parameters used for the call to ensure you don't use an item in the cache that was called using different parameters.
In what language? Generally: Use the function signature and actual parameters as key and serialize and store the answer with a timestamp. Next time check for it.
精彩评论