Hi,

Is it possible to have access to request data inside a caching callback? I 
would like to set whether a view is cacheable dependant on what the data passed 
was.

My use-case: I'm using Agavi to combine + minify js/css files on demand, and I 
would like them to be cached using Agavi's caching mechanism. In order to get 
the files also cached by the browser, but only up until the time they are 
modified, I'm setting far-future expires headers, and the URLs for the files 
are in the form:

scripts.v12312412123.js

where the number is the last modification time of the included files. I can 
also get this cached easily using the Agavi caching mechanism.

*However* the issue is that the caching uses the modification time as a cache 
key, but that *any* modification time passed in the URL results in a "success" 
view. This leaves open the possibility of an attack, as hitting the server with 
all possible modification times will result in every single success view being 
cached, and disk space will quickly fill up.

So, in the the caching callback I want to check the requested modification 
time, and see if it's equal to the latest modification time for the files. If 
it's not, I will throw an AgaviUncacheableException in order to make sure the 
view is not cached.

Is what I want possible / (or a bad idea?)

Michal.




_______________________________________________
users mailing list
[email protected]
http://lists.agavi.org/mailman/listinfo/users

Reply via email to