gitweb: Support caching projects listgitweb/cache
commit3f025da1eed1286c2a91cc89472b84dd4fae540a
authorPetr Baudis <pasky@suse.cz>
Sat, 31 May 2008 13:07:26 +0000 (31 15:07 +0200)
committerJakub Narebski <jnareb@gmail.com>
Sat, 31 May 2008 13:07:26 +0000 (31 15:07 +0200)
treeb81b14807d71dd98e9af348b0ab556e97993309e
parent525a4f0cb1883a28a0aec91af4f98d4310d3b0f6
gitweb: Support caching projects list

On repo.or.cz (permanently I/O overloaded and hosting 1050 project +
forks), the projects list (the default gitweb page) can take more than
a minute to generate. This naive patch adds simple support for caching
the projects list data structure so that all the projects do not need
to get rescanned at every page access.

$projlist_cache_lifetime gitweb configuration variable is introduced,
by default set to zero. If set to non-zero, it describes the number of
minutes for which the cache remains valid. Only single project root
per system can use the cache. Any script running with the same uid as
gitweb can change the cache trivially - this is for secure
installations only.

The cache itself is stored in $cache_dir/$projlist_cache_name using
Storable to store() Perl data structure with the list of project
details.  When reusing the cache, the data is retrieve()'d back into
@projects.

To prevent contention when multiple accesses coincide with cache
expiration, the timeout is postponed to time()+120 when we start
refreshing.  When showing cached version, a disclaimer is shown
at the top of the projects list.

[jn: moved from Data::Dumper to Storable for serialization of data]

Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
gitweb/README
gitweb/gitweb.css
gitweb/gitweb.perl