gitweb/lib - Adaptive cache expiration time
authorJakub Narebski <jnareb@gmail.com>
Sun, 5 Dec 2010 20:48:54 +0000 (21:48 +0100)
committerJakub Narebski <jnareb@gmail.com>
Sun, 5 Dec 2010 20:48:54 +0000 (21:48 +0100)
commit6307fd4d48add6acc9643eeb25880be949481bdb
tree82f33e485ce80b298787da46d31247ada5ad30ad
parentf45c3bb1ea9c0e80337e2fff5abf6bd4eee6ddae
gitweb/lib - Adaptive cache expiration time

Add to GitwebCache::SimpleFileCache support for adaptive lifetime
(cache expiration) control.  Cache lifetime can be increased or
decreased by any factor, e.g. load average, through the definition
of the 'check_load' callback.

Note that using ->set_expires_in, or unsetting 'check_load' via
->set_check_load(undef) turns off adaptive caching.

Make gitweb automatically adjust cache lifetime by load, using
get_loadavg() function.  Define and describe default parameters for
dynamic (adaptive) cache expiration time control.

There are some very basic tests of dynamic expiration time in t9503,
namely checking if dynamic expire time is within given upper and lower
bounds.

Inspired-by-code-by: John 'Warthog9' Hawley <warthog9@kernel.org>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
gitweb/gitweb.perl
gitweb/lib/GitwebCache/SimpleFileCache.pm
t/t9503/test_cache_interface.pl