eclipse-archived / ceylon-herd

The Ceylon repository web application
Apache License 2.0
21 stars 11 forks source link

Improve HTTP cache behavior of module artifacts #274

Open lucaswerkmeister opened 7 years ago

lucaswerkmeister commented 7 years ago

Currently, we send a fairly short caching time (1 hour) for module resources:

$ curl -Iis https://modules.ceylon-lang.org/repo/1/ceylon/language/1.3.0/ceylon.language-1.3.0.car | grep -i ^cache-control:
Cache-Control: max-age=3600

Perhaps it’s good to have a short max-age during release, in case we screw something up, but the rest of the time, I don’t see why the header couldn’t be much longer. This could improve loading time of Ceylon applications running in the browser (e. g. the web IDE).

In fact, we could go even further and add the immutable attribute: the justification for it –

Facebook, like many sites, uses versioned URLs - these URLs are never updated to have different content and instead the site changes the subresource URL itself when the content changes.

– sounds like a good fit to our repositories of versioned modules, where a new resource should also mean a new version.

@jvasileff: you said something about the cache in https://github.com/ceylon/ceylon-herd/issues/244#issuecomment-157751949 which I don’t understand, do you want to chime in here?

quintesse commented 7 years ago

Seems like a good idea

jvasileff commented 7 years ago

@lucaswerkmeister that was for something different: after a bad download or copy, the client would create a new .sha1 file in ~/.ceylon/cache of the corrupt artifact (e.g. .car file).