zombofant / pyxwf

eXtensible Web Framework in Python
http://zombofant.net/hacking/pyxwf
Other
2 stars 1 forks source link

Crumbs cannot invalidate clients cache #2

Open horazont opened 11 years ago

horazont commented 11 years ago

Right now, crumbs are not taken into account when calculating the Last-Modified date of the response. This is due to the fact that we cannot determine which crumbs will be used in a response until it is rendered completely. Rendering being the most expensive part, we obviously want to avoid it as far as possible.

Sadly, this is in conflict with proper un-caching on the client side. We'll have to at least allow the user to declare crumbs which will for sure be used and should be taken into account. We could also try to do static analysis on this one, by parsing the templates by hand. Using a conservative approach, it should be possible to extract the used crumbs in all used templates. To not break things, invalid crumb IDs must be ignored here.

We then could ask these crumbs for a (yet to be defined) LastModified property which can be taken into account. Nodes could also get a possibility to specify crumbs which they are embedding, if any.

This yields an out-of-date navigation on zombofant.net when someone posts a new blogpost, which is bad (cause the post won't be seen until the user does a hard reload). Workaround: Touch some template which is used on all pages.

horazont commented 11 years ago

Using a conservative approach, it should be possible to extract the used crumbs in all used templates.

Obviously, this will already break if one uses dynamic crumb IDs and we won't be able to infer that.