Closed (fixed)
Project:
Boost
Version:
6.x-1.x-dev
Component:
Expiration logic
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
7 Nov 2008 at 19:57 UTC
Updated:
4 Jul 2009 at 02:20 UTC
If your site contains many pages, boost_cron() is rather slow and it hangs server for some time. We need dynamic cache expiration. If you have access to httpd.conf, you can use this solution.
It is based on RewriteMap Apache directive. RewriteMap can be external Rewriting Program (in this case php script that checks whether cache files are old or not).
This is not a universal solution, but some people can find it useful.
Archive contatins installation instructions, my expite.php and .htaccess. It will work on both boost5 and boost6.
| Comment | File | Size | Author |
|---|---|---|---|
| dynamic_expire.ZIP | 2.97 KB | alex s |
Comments
Comment #1
EvanDonovan commentedAfter applying this patch, Boost doesn't seem to be serving up the pages from the cache, even though they are being created. Also, it seems to have slowed down the server significantly.
I am also using the patch to exclude the files directory from caching, the patch to stop creating symlinks, and my own custom rewrite rules to make Boost compatible with the Referertools module. However, I had all these working until the patch was applied. Here's my rewrite rules:
Comment #2
mikeytown2 commentedI think a better idea would be to inject a 1px clear gif at the bottom of the cached page that returns asap but then checks to see if the file is expired. Makes this applicable to any hosting situation & allows for an easy on/off switch; maybe even per page control of the cache.
http://px.sklar.com/code.html/id=256
Comment #3
mikeytown2 commentedThis works in terms of an image that returns right away and allows for the script to do stuff in the background. Use
$_SERVER['HTTP_REFERER']to get the pages url, then use that and check the file's creation time. Or should I pass the URL to this function by something like thiswhere *** is something like
urlencode(XOREncrypt($url,1));http://www.jonasjohn.de/snippets/php/xor-encryption.htm1 would be a randomly generated key that gets stored in the DB, preventing almost all people from trying to force a cleared cache of an expired file that doesn't have this img tag & is still in the boost cache.
Comment #4
mikeytown2 commentedComment #5
yhager commented#3 is an awesome idea to get rid of that cron, which is horrible for large sites' performance. However, it means that to refresh a stale page, one user has to view it first. So if your boost cache lifetime is 10 minutes, and the file was not accessed for a day, the first user will say a day-old file.
Comment #6
mikeytown2 commentedthis needs a lot of work in order for this to fly.
Comment #7
mikeytown2 commentedpostponed until #453426: Merge Cache Static into boost - Create GUI for database operations is done. I can then use the database to clear the cache... although thinking about this, with the DB you could run a boost only cron every 1 min and have about the same effect.
Comment #8
mikeytown2 commentedOnce the database goes in, making a separate file that one can call for cron makes since. Ship with it's own cron.php file that boots up the Database and then clears expired pages makes more since then the original post. Will use the image code for #422620: Support Drupal's built in statistics module..
Comment #9
mikeytown2 commentedalt my own cron file
http://drupal.org/project/elysia_cron
http://drupal.org/project/supercron
One of these should allow for boost cron to be run every 10 min, all others every hour; or something to that effect.
Comment #10
mikeytown2 commentedLightweight alt
http://www.opensourcery.com/blog/dylan-tack/choosier-cron-runs