summaryrefslogtreecommitdiff
path: root/README
diff options
context:
space:
mode:
Diffstat (limited to 'README')
-rw-r--r--README54
1 files changed, 54 insertions, 0 deletions
diff --git a/README b/README
new file mode 100644
index 0000000..5917c37
--- /dev/null
+++ b/README
@@ -0,0 +1,54 @@
+Cache algorithm
+===============
+
+Cgit normally returns cached pages when invoked. If there is no cache file, or
+the cache file has expired, it is regenerated. Finally, the cache file is
+printed on stdout.
+
+When it is decided that a cache file needs to be regenerated, an attempt is
+made to create a corresponding lockfile. If this fails, the process gives up
+and uses the expired cache file instead.
+
+When there is no cache file for a request, an attempt is made to create a
+corresponding lockfile. If this fails, the process calls sched_yield(2) before
+restarting the request handling.
+
+In pseudocode:
+
+ name = generate_cache_name(request);
+top:
+ if (!exists(name)) {
+ if (lock_cache(name)) {
+ generate_cache(request, name);
+ unlock_cache(name);
+ } else {
+ sched_yield();
+ goto top;
+ }
+ } else if (expired(name)) {
+ if (lock_cache(name)) {
+ generate_cache(request, name);
+ unlock_cache(name);
+ }
+ }
+ print_file(name);
+
+
+The following options can be set in /etc/cgitrc to control cache behaviour:
+ cache-root: root directory for cache files
+ cache-root-ttl: TTL for the repo listing page
+ cache-repo-ttl: TTL for any repos summary page
+ cache-dynamic-ttl: TTL for pages with symbolic references (not SHA1)
+ cache-static-ttl: TTL for pages with sha1 references
+
+TTL is specified in minutes, -1 meaning "infinite caching".
+
+
+Naming of cache files
+---------------------
+Repository listing: <cachedir>/index.html
+Repository summary: <cachedir>/<repo>/index.html
+Repository subpage: <cachedir>/<repo>/<page>/<querystring>.html
+
+The corresponding lock files have a ".lock" suffix.
+
r>2020-05-27Remove vim-latex configsRené 'Necoro' Neumann2-24/+0 2020-04-15Simplify check_libsRené 'Necoro' Neumann1-6/+2 2020-04-15Explicitly set PAGERRené 'Necoro' Neumann1-0/+1 2020-04-12[vim] Syntax coloring by default, if supportedRené 'Necoro' Neumann1-0/+4 2020-04-12Fix scrolling in screenRené 'Necoro' Neumann1-0/+4 2020-04-11UpdateRené 'Necoro' Neumann1-0/+0 2020-04-05Replace git:// by https://René 'Necoro' Neumann1-2/+2 2020-02-17Update urxvt extension configRené 'Necoro' Neumann2-4/+120 2020-02-17Remove urxvt wgetpaste extensionRené 'Necoro' Neumann2-30/+1 2020-02-17[i3] Wifi: Include frequenceRené 'Necoro' Neumann1-1/+1 2020-02-17Put ssh-agent into the i3 environment.René 'Necoro' Neumann1-0/+1 2020-02-17Update cci: stgit now uses python3René 'Necoro' Neumann1-1/+1 2020-02-17Revert "Local Changes"René 'Necoro' Neumann2-5/+3 2020-02-17Update vundleRené 'Necoro' Neumann1-0/+0 2020-02-17Enable secondary screen in urxvtRené 'Necoro' Neumann1-0/+1 2020-02-17Local ChangesRené 'Necoro' Neumann2-3/+5 2018-06-10[i3] Replace icons by font awesomeRené 'Necoro' Neumann24-149/+13 2018-06-10[i3] Remove obsolete pidgin stuffRené 'Necoro' Neumann2-36/+0 2018-06-10[zsh] Remove obsolete isabelle functionsRené 'Necoro' Neumann2-112/+0 2018-06-10Misc changesRené 'Necoro' Neumann3-0/+7 2018-06-10[git] Update email addressRené 'Necoro' Neumann1-1/+1 2018-06-10Enhance cci scriptRené 'Necoro' Neumann1-15/+12 2017-11-18Some windows setupRené 'Necoro' Neumann2-1/+6 2017-10-08[zsh] Use zcalc instead of bcRené 'Necoro' Neumann1-5/+4 2017-10-08[zsh] CalculatorRené 'Necoro' Neumann1-0/+8 2017-10-08Some vim changes.René 'Necoro' Neumann4-28/+17 2017-10-08Delete old stuff.René 'Necoro' Neumann5-71/+1