0

I have set cache:true in my jquery get service request. But this is not working. When i run the fiddler parallel, everytime my url is being hit rather than response fetched from cache. How do I test my data is fetched from cache. I believe using fiddler is the correct approach to test? Any pointers will be really helpful to me. Also I have noted down in my http headers it always send the below two parameters though I have set as cache:true

Cache-Control:no-cache
Pragma:no-cache

But my http response headers which is comes from server is not having these above two http attributes.

CodePen : http://codepen.io/selvaonline/pen/gpyLRz

user5075511
  • 421
  • 1
  • 5
  • 11
  • Please show code used. You have a typo in question for `cahce:true` .. should be `cache:true` – charlietfl Aug 12 '15 at 20:17
  • Can you share your code. Meantime try reading this post: http://stackoverflow.com/questions/17104265/caching-a-jquery-ajax-response-in-javascript-browser – anam Aug 12 '15 at 20:17
  • Make sure you don't have `Rules->Performance->Disable Caching` checked in fiddler – CupawnTae Aug 12 '15 at 20:20
  • Really not clear enough what is going on with just a snipped of header information...where's the code used? I suspect this is a confusion of what ajax cache means – charlietfl Aug 12 '15 at 20:22
  • @charlietfl,@anam i have created a codepen http://codepen.io/selvaonline/pen/gpyLRz by following the stackoverflow example but still it is not working. Can you please help? – user5075511 Aug 12 '15 at 20:59
  • @CupawnTae I have checked and i don't have any Disable Cache enabled on my fiddler settings – user5075511 Aug 12 '15 at 21:01
  • What exactly are your expectations? The actual problem has not been clearly identified. Also demo didn't event include jQuery and throws error. – charlietfl Aug 12 '15 at 21:03
  • i want to cache my ajax response for 1 minute, if user click the button before one minute the url should not get fired and the response should get it from the cache. thats it. – user5075511 Aug 12 '15 at 21:05
  • @charlietfl i have created other simple jquery via codepen, even that is not working. Can you please help? http://codepen.io/selvaonline/pen/gpyLej – user5075511 Aug 12 '15 at 21:27
  • Store time of last request. Store response data. If time less than one minute use local data, if not make new request and store it and update time. Shouldn't be complicated – charlietfl Aug 12 '15 at 23:08
  • @charlietfl Can i use the browser cache instead of this local cache?https://developers.google.com/speed/docs/insights/LeverageBrowserCaching?csw=1#LeverageBrowserCaching. What is the advantage and disadvantage? – user5075511 Aug 13 '15 at 15:52
  • No, not really. Different use case – charlietfl Aug 13 '15 at 16:03

0 Answers0