Versioned resources to encourage browser caching

View: New views
3 Messages — Rating Filter:   Alert me  

Versioned resources to encourage browser caching

by Martijn Dashorst :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Would it be possible to generate resource paths with a version string
in them so that browsers will cache resources, but request new ones
when a version has been bumped?

e.g.

http://example.com/resources/org.apache.wicket/wicket-1.4.1/wicket-ajax.js
http://example.com/resources/nl.topicus.project/project-2.0-12341/project.js

Used this way we can let those resources never expire, taking only a
hit for the first time the resources are requested.

Perhaps http://example.com/resources/org.apache.wicket.wicket-ajax.js?version=1.4.1
works also, but something tells me browsers might not cache this.

Martijn

Re: Versioned resources to encourage browser caching

by Matej Knopp :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

We have already a setting that will append last modified time to resource URL.

-Matej

On Thu, Oct 15, 2009 at 6:19 PM, Martijn Dashorst
<martijn.dashorst@...> wrote:

> Would it be possible to generate resource paths with a version string
> in them so that browsers will cache resources, but request new ones
> when a version has been bumped?
>
> e.g.
>
> http://example.com/resources/org.apache.wicket/wicket-1.4.1/wicket-ajax.js
> http://example.com/resources/nl.topicus.project/project-2.0-12341/project.js
>
> Used this way we can let those resources never expire, taking only a
> hit for the first time the resources are requested.
>
> Perhaps http://example.com/resources/org.apache.wicket.wicket-ajax.js?version=1.4.1
> works also, but something tells me browsers might not cache this.
>
> Martijn
>

Re: Versioned resources to encourage browser caching

by Juergen Donnerstag :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I saw this link being referenced recently. Ignore the name "speed up
caching" etc. The entry also talks about resource versioning etc.

"This leads to another question though: How to get a version for each
resource? Using your application’s version (if you have one) might be
appropriate but depends on how often you deploy new versions, as a new
version will make all cached (i.e. even unchanged) resources obsolete.

....
"
http://techblog.molindo.at/2008/08/wicket-interface-speed-up-caching-resources-forever.html

Juergen