On May 8, 2009, at 4:34 PM, will welch wrote:
Because I was caching entire pages generated by a controller, I dodged working out such a creation function (with its own controller environment and SA session). Instead I wrote a middleware that intercepts a page request, fires up a thread that does a urllib.urlretrieve on that same url but with a secret update-the-cache url parameter set, meanwhile proceeding with forwarding the request along the stack for processing in the usual way (which will ultimately fetch the currently cached version of the requested page with no delay).
You have some sort of locking in place so that only one thread is spawned? I mean, if it was to expire, and 30 requests came in at the same time before it was done, it wouldn't fire up 30 threads would it?
Cheers, Ben
smime.p7s
Description: S/MIME cryptographic signature