This project is read-only.
1
Vote

Client cache not working

description

All shinkansen resources do not cache on the client. We can see that clearly with firebug. Each time the browser gets a fresh copy from server with status code 200.
Like this site says on your home page, your code supports caching on server and client.
Please advise. It's production, and performance is now our top priority.
 
Thanks, Benny

comments

borismee wrote Jul 26, 2010 at 2:17 PM

You can see the production version here: http://tss.thestocksonar.com/

MilanNegovan wrote Jul 26, 2010 at 2:58 PM

Benny, I see the client-site caching headers set correctly, e.g.:

Cache-Control public, must-revalidate, proxy-revalidate, max-age=31536000
Content-Type text/javascript
Content-Encoding gzip
Expires Tue, 26 Jul 2011 13:55:42 GMT

Which resource in particular is not getting cached?

Thank you,
Milan

MilanNegovan wrote Jul 26, 2010 at 3:03 PM

One more thought. Try this: go to Test Drive, then back to the home page (click the logo). Keep an eye on resources in Firebug. You'll see that none of the Shinkansen resources are requested again due to client caching.

If you actually refresh the page, you'll see them served with status code 200, which is how it's supposed to work.

You won't see server-side caching in Firebug. It just makes sure it doesn't cruch & compress resources without need.

bhalperin wrote Jul 26, 2010 at 3:25 PM

Milan,

Yes I repeated your scenario and it doesn't reload scripts when I navigate to home page.
Still, question is - when I refresh pressing F5 I get status code 200 like you say, but it should be 304 (not modified). That is the case with other scripts/images I use.
I do get all scripts re-fetched with status code 200 if I press Ctrl-F5, and that's ok.

Benny

MilanNegovan wrote Jul 26, 2010 at 4:01 PM

Benny, if you refresh the page by hand, the browser bypass cache and requests everything anew.

304 (Not Modified) is served only with the "Last-Modified" header, which is different. Usually, a round trip is wasted for no good reason, i.e. to check that a file was not modified. This is why I don't check for this header in Shinkansen. I build the URL is a way which guarantees the resource wasn't changed at all.

Hence, when you navigate between pages with Shinkansen resources, you won't even see them requested because they are already cached on the client.

wrote Feb 13, 2013 at 11:32 PM