Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cloud end points is giving cached response

I was using cloud endpoints services using javascript client library. I'm trying to get the data from the endpoints service but each time i'm requesting i'm getting different data which is cached by endpoints api i guess. Is there any way to make endpoints services not to cache data ? This is the sample responses i'm getting by hitting https://application.appspot.com/_ah/api/jobssyste/v1/servicetogetdata?accountNumber=8661234567

Here i'm getting responses on consecutive requests

Response of First Request :
{
 "monday": "02:30 PM,11:45 PM",
 "tuesday": "",
 "wednesday": "08:00 AM,05:00 PM",
 "thursday": "07:45 AM,06:45 PM",
 "friday": "08:00 AM,05:00 PM",
 "saturday": "08:00 AM,05:00 PM",
 "sunday": "08:00 AM,05:00 PM",
 "kind": "jobssystem#resourcesItem",
 "etag": "\"nXb0hCUd6fAuJMw6L-7tyR6KAhg/yP01K1lA_xkLIWbvG0lm7rzvQBU\""
}

Response of Second Request : 
{
 "monday": "02:30 PM,11:45 PM",
 "tuesday": "08:00 AM,05:00 PM",
 "wednesday": "08:00 AM,05:00 PM",
 "thursday": "07:45 AM,06:45 PM",
 "friday": "08:00 AM,05:00 PM",
 "saturday": "",
 "sunday": "",
 "kind": "jobssystem#resourcesItem",
 "etag": "\"nXb0hCUd6fAuJMw6L-7tyR6KAhg/KxBc34PXMgKGm7BmXfpXvGtWGbk\""
}

But firstResponse data is what i have in my DataStore. Couldn't able to find from where this cached data is coming from. Even i tried with mentioning not to cache in endpoints methods using. @ApiMethodCacheControl(noCache=true,maxAge=0). Quick and accurate solution is appriciated. Thank you.

like image 847
Vali Shah Avatar asked Nov 10 '22 11:11

Vali Shah


1 Answers

According to RFC2616 (specifically the part on Idempotent Methods), identical GET requests for a URL should always return the same value. Thus, caching of that value is perfectly acceptable. Use POST if you're expecting dynamic data.

If that doesn't fix things, you'll have to do network traces (chrome://net-internals can show you what is going on) to see exactly what is being sent and received on the network.

like image 146
Brian White Avatar answered Dec 16 '22 09:12

Brian White