Lars Hjemli | 25105d7 | 2006-12-10 22:31:36 +0100 | [diff] [blame] | 1 | |
Lars Hjemli | dcef257 | 2006-12-13 02:06:29 +0100 | [diff] [blame^] | 2 | cgit - cgi for git |
Lars Hjemli | 25105d7 | 2006-12-10 22:31:36 +0100 | [diff] [blame] | 3 | |
| 4 | |
Lars Hjemli | dcef257 | 2006-12-13 02:06:29 +0100 | [diff] [blame^] | 5 | This is an attempt to create a fast web interface for the git scm, using a |
| 6 | frontside cache to decrease server io-pressure. |
Lars Hjemli | 25105d7 | 2006-12-10 22:31:36 +0100 | [diff] [blame] | 7 | |
Lars Hjemli | dcef257 | 2006-12-13 02:06:29 +0100 | [diff] [blame^] | 8 | When cgit is invoked, it looks for a cached page matching the request. If no |
| 9 | such cachefile exist (or it has expired), it is (re)generated. Finally, the |
| 10 | cachefile is returned to the client. |
Lars Hjemli | 25105d7 | 2006-12-10 22:31:36 +0100 | [diff] [blame] | 11 | |
Lars Hjemli | dcef257 | 2006-12-13 02:06:29 +0100 | [diff] [blame^] | 12 | If the cachefile has expired, but cgit is unable to lock the cachefile, the |
| 13 | client will get the stale cachefile after all. This is done to favour page |
| 14 | throughput over page freshness. |
Lars Hjemli | 25105d7 | 2006-12-10 22:31:36 +0100 | [diff] [blame] | 15 | |
Lars Hjemli | dcef257 | 2006-12-13 02:06:29 +0100 | [diff] [blame^] | 16 | Also, when a cachefile is generated, a few cache-related http-headers are |
| 17 | created: "Modified" is set to current time(2), while "Expires" is set to |
| 18 | time(2) + <cachefile TTL> * 60 (unless the TTL is negative, in which case it |
| 19 | is read as "60 * 60 * 24 * 365"). This is done to avoid repeated requests for |
| 20 | already visited pages. |
Lars Hjemli | 25105d7 | 2006-12-10 22:31:36 +0100 | [diff] [blame] | 21 | |
Lars Hjemli | dcef257 | 2006-12-13 02:06:29 +0100 | [diff] [blame^] | 22 | The following cache-related options can be set in /etc/cgitrc: |
Lars Hjemli | 25105d7 | 2006-12-10 22:31:36 +0100 | [diff] [blame] | 23 | |
Lars Hjemli | dcef257 | 2006-12-13 02:06:29 +0100 | [diff] [blame^] | 24 | cache-root=<path> root directory for cache files |
| 25 | cache-root-ttl=<min> TTL for the repo listing page |
| 26 | cache-repo-ttl=<min> TTL for repo summary pages |
| 27 | cache-dynamic-ttl=<min> TTL for pages with symbolic references |
| 28 | cache-static-ttl=<min> TTL for pages with sha1 references |
| 29 | |
| 30 | The cachefiles are split into different directories, based on the requested |
| 31 | repository and page: |
| 32 | |
| 33 | Repo listing: <cachedir>/index.html |
| 34 | Repo summary: <cachedir>/<repo>/index.html |
| 35 | Repo subpage: <cachedir>/<repo>/<page>/<querystring>.html |