[mod_python] Sending a message to Apache children

Seth Ladd seth at picklematrix.net
Mon Nov 10 11:29:07 EST 2003


On Nov 10, 2003, at 11:16 AM, Simon Willison wrote:

> Hi all,
>
> Is there a way of sending a "message" to all Apache children running a 
> mod_python application? Here's the problem: we have a template system 
> which compiles template strings in to an in-memory data structure. 
> This structure is cached in memory in a global dictionary for each 
> Apache child. At the moment templates are stored in the cache with a 
> timestamp saying when they were loaded, and expire and are reloaded 
> every 5 minutes. We want to be able to instantly invalidate a cached 
> template if an urgent change needs to be made to the site.
>
> Is there a way of pushing out a message to all of the Apache children 
> saying "reload template X NOW", without having to hit the file system 
> or database for every template request?

Do you check the timestamp on the template from the filesystem?  That 
might be better than to just throw away the template every 5 minutes.  
I can assume that most templates will be static for longer than 5 
minutes.

Seth



More information about the Mod_python mailing list