diff --git a/checkin_notes b/checkin_notes
index c846c09a37..c537295f05 100755
--- a/checkin_notes
+++ b/checkin_notes
@@ -442,7 +442,16 @@ David 11 Jan 2007
Sometimes the cache gets so full that it takes 30 secs
just to compute free and used disk space,
so that normal cleanup times out before it does anything.
- I recommend running clean_cache.php once a day.
html/ops/
clean_cache.php (new)
+
+David 11 Jan 2007
+ - user web: call set_time_limit(0) in cache_check_diskspace().
+ This will hopefully avoid the situation described above.
+
+ html/
+ inc/
+ cache.inc
+ project.sample/
+ cache_parameters.inc
diff --git a/doc/create_project.php b/doc/create_project.php
index 3db1de07fd..75b80072d1 100644
--- a/doc/create_project.php
+++ b/doc/create_project.php
@@ -140,7 +140,7 @@ Web site
Web site translation
Server status page
Profile screening
- Caching and translation
+ Caching
Miscellaneous
diff --git a/doc/web_cache.php b/doc/web_cache.php
index 5f7ab885dd..1f8f0c120a 100644
--- a/doc/web_cache.php
+++ b/doc/web_cache.php
@@ -1,8 +1,34 @@
Caching configuration
+
+The file html/project/cache_parameters.inc
+contains a number of parameters related to caching:
+";
+list_start();
+list_item("TEAM_PAGE_TTL", "Cache life of team pages; default 1 hour");
+list_item("USER_PAGE_TTL", "Cache life of user pages; default 1 hour");
+list_item("USER_HOST_TTL", "Cache life of user host list; default 1 hour");
+list_item("USER_PROFILE_TTL", "Cache life of profiles; default 1 hour");
+list_item("TOP_PAGES_TTL", "Cache life of user/team/host lists; default 12 hours");
+list_item("INDEX_PAGE_TTL", "Cache life of main page; default 1 hour");
+list_item("MAX_CACHE_USAGE", "Max cache size; default 100 MB");
+list_item("MIN_FREE_SPACE", "Min free space on device; default 100 MB");
+list_item("CACHE_SIZE_CHECK_FREQ", "Check cache size on every N user accesses to cached pages; default 1000");
+list_end();
+echo "
+
Caching and translation
BOINC uses several web-page caching systems,
which support language translation in different ways.
diff --git a/html/inc/cache.inc b/html/inc/cache.inc
index b19234b477..58d5ac536e 100644
--- a/html/inc/cache.inc
+++ b/html/inc/cache.inc
@@ -84,13 +84,14 @@ function clean_cache($max_age, $dir) {
// check free disk space every once in a while
function cache_check_diskspace(){
if (!(rand() % CACHE_SIZE_CHECK_FREQ)) {
- $too_old=86400;
- while ((disk_free_space("../cache") < MIN_FREE_SPACE) ||
- (disk_usage("../cache") > MAX_CACHE_USAGE)
+ set_time_limit(0); // this may take a while
+ $max_age = 86400;
+ while ((disk_free_space("../cache") < MIN_FREE_SPACE) ||
+ (disk_usage("../cache") > MAX_CACHE_USAGE)
) {
- clean_cache($too_old, "../cache");
- $too_old/=2;
- }
+ clean_cache($max_age, "../cache");
+ $max_age/=2;
+ }
}
}
diff --git a/html/project.sample/cache_parameters.inc b/html/project.sample/cache_parameters.inc
index adcadefe56..9e4846ad24 100644
--- a/html/project.sample/cache_parameters.inc
+++ b/html/project.sample/cache_parameters.inc
@@ -2,20 +2,19 @@
// Define the lifetime of public php pages.
// define to zero to turn of caching for these pages.
-define('TEAM_PAGE_TTL',3600);
-define('USER_PAGE_TTL',3600);
-define('USER_HOST_TTL',3600);
-define('USER_PROFILE_TTL',3600);
-define('TOP_PAGES_TTL',43200);
-define('DOWNLOAD_PAGE_TTL',3600);
-define('INDEX_PAGE_TTL',3600);
+define('TEAM_PAGE_TTL', 3600);
+define('USER_PAGE_TTL', 3600);
+define('USER_HOST_TTL', 3600);
+define('USER_PROFILE_TTL', 3600);
+define('TOP_PAGES_TTL', 43200);
+define('INDEX_PAGE_TTL', 3600);
// Define the max allowed cache usage and the min allowed free space
// Both default to 100M.
-define('MAX_CACHE_USAGE',104857600);
-define('MIN_FREE_SPACE',104857600);
+define('MAX_CACHE_USAGE', 104857600);
+define('MIN_FREE_SPACE', 104857600);
// Number of page views between cache size checks
-define('CACHE_SIZE_CHECK_FREQ',1000);
+define('CACHE_SIZE_CHECK_FREQ', 1000);
?>