|
1 | 1 | <?php |
2 | 2 |
|
3 | | -// Define the lifetime of public php pages. |
4 | | -// define to zero to turn of caching for these pages. |
| 3 | +// Some web pages need lots of DB access to generate. |
| 4 | +// To reduce DB server load, these pages |
| 5 | +// (actually, the data used to create them) can be cached. |
| 6 | +// Each type of page has a 'time to live' (TTL) parameter. |
| 7 | +// If the age of a cached page exceeds the TTL, |
| 8 | +// the page is regenerated. |
| 9 | +// |
| 10 | +// TTL = 0 means don't cache that type of page |
| 11 | + |
5 | 12 | define('TEAM_PAGE_TTL', 3600); |
6 | 13 | define('USER_PAGE_TTL', 3600); |
7 | | -define('USER_HOST_TTL', 3600); |
8 | 14 | define('USER_PROFILE_TTL', 3600); |
9 | | -define('TOP_PAGES_TTL', 43200); |
| 15 | +define('TOP_PAGES_TTL', 0); |
| 16 | + // host/user/team leader boards |
| 17 | + // caching these causes inconsistent results |
10 | 18 | define('INDEX_PAGE_TTL', 3600); |
11 | 19 | define('STATUS_PAGE_TTL', 3600); |
12 | 20 | define('REMOTE_PROJECTS_TTL', 86400); |
13 | 21 |
|
14 | | -// max allowed cache usage |
| 22 | +// max allowed cache usage, bytes |
15 | 23 | // |
16 | | -define('MAX_CACHE_USAGE', 104857600); |
| 24 | +define('MAX_CACHE_USAGE', 1e9); |
| 25 | + |
| 26 | +// the cache can grow without bound, |
| 27 | +// so every so often we need to check its size and |
| 28 | +// delete old entries. |
| 29 | +// We do this randomly, on average every N page views |
17 | 30 |
|
18 | | -// Number of page views between cache size checks |
19 | 31 | define('CACHE_SIZE_CHECK_FREQ', 1000); |
20 | 32 |
|
21 | 33 | ?> |
0 commit comments