I am having a strange issue. Say i am calling service B from service A. In service A, I am caching the response from service B. Say Cache time is set as 60secs. So if I call second time after 60secs, the response is not retrieved from cache and so its giving a call to the service B but instead of one call its giving two call one with HEAD (this one fails) and the other with GET(this one returns correctly). But this response is not cached by the service A. If I give third call within 60 secs, then only one call goes to Service B as expected and the response is also cached properly.
I check the Document Cache Status and its showed that, after 60secs of the first call, the document cache size is not 0(say X bytes) but after second call(the one which triggers two call -HEAD and GET), the document count remains 1 but size is 0 bytes. After 3rd call, the cache size changes to X bytes again.
Can you let me know I am doing something wrong? From where two calls are going to the service B from Service A and why the first one is HEAD? I tried to call the service service B from SOAP UI using GET and the service B is working properly but service A is behaving strangely
JonPalgon 110000NHS175 Posts
Re: Document Cache Problem2012-10-30T19:54:11ZThis is the accepted answer. This is the accepted answer.> From where two calls are going to the service B from Service A and why the first one is HEAD?
Even though the document is expired from the cache, DP doesn't have background task that goes around cleaning up the expired entries. You should see expired, but still cached documents using the 'show document-status' CLI command. When the second request comes in (after the 60seconds), DP looks up in its cache and finds this expired entry. To potentially minimize network traffic, DP will send a conditional HEAD request to see if the cached, but expired entry is still valid. If not (which is the case here), it will send a full GET request to the origin server. Why DP does not cache the response of this GET request is questionable, but hopefully I answered the first question.