I was just wondering, doesn’t the Asset Timestamping plugin totally
defeat the caching of your assets (js and css files) by the browser?
Wouldn’t this increase the page load time on each hit?
The asset_timestamping plug-in adds timestamps to your assets’ URLS as a
managing the client-side (browser) cache. If those timestamps were the
current time, the effect would be what you’re worried about–browsers
think they never had the assets being asked for, so they would never be
satisfy any requests from their cache, and page load times would
But that’s not what asset_timestamping does; the timestamp it adds to
asset URL is derived from the time each of your files was last
means that as long as you don’t change the asset files, the timestamps
the same and client browsers will be happy to cache the files, just as
normally do. The only time this situation is changed is when you change
file–which causes it’s timestamp to change, which makes your browser
needs a different file, which isn’t in its cache, and so it requests it.
It’s exactly the behavior you want–you get the benefit of caching,
you change an asset file, in which case browsers load the changed asset
changes take effect immediately, instead of waiting for all the browser
to be clear out.
I’ve found it to be really useful during the development phase when
constantly monkeying with CSS files–I don’t need to call everyone up
time and say “hey, I fixed that thing, but you need to type control-F5
browser to see the fix. . .”.