On Wed, Apr 28, 2010 at 1:13 PM, Felix Meschberger
<[email protected]> wrote:
> Hi all,
>
> I have been resonating with a collegue about a request level Filter
> for Sling to support caching.
>
> The idea (and partly implemented by a prototype) is to have the
> request filter setup default caching behaviour of the response (if the
> response is cacheable at, that is the request method must be GET and
> there are no request parameters):
>
> * The Cache-Control header is preset with values from configuration
> matching the request URI (or resource path)
> * The Last-Modified header is preset with the jcr:lastModified
> property of the requet's resource
> * Eager responding with 304/NOT MODIFIED if the If-Modified-Since
> header is set and a last modification time of the resource can be
> resolved.

The question is how useful such a filter would be if only the
last-modified date of the requested resource is used.

In our application at least, there is a large number of resources
involved when serving a request. Most CMSs list out menus, for
example, where the menu items are other resources. If one of those
resources have changed, or if there has been a new menu item created,
it means the menu will be out of date if the requested resource itself
is unmodified.

To solve this, we could introduce a resource tracker, which tracks
which resources are being invoked on a request. The latest
last-modified date of these resources will then be matched with the
requests If-Modified-Since header.

-- 
Vidar S. Ramdal <[email protected]> - http://www.idium.no
Sommerrogata 13-15, N-0255 Oslo, Norway
+ 47 22 00 84 00 / +47 21 531941, ext 2070

Reply via email to