CGit is another cgi-app for git.
It is written in C (using libgit.a), and implements an internal page
cache. A PoC version is available for cloning at
git://hjemli.net/pub/git/cgit
and it is also (barely) selfhosted at
http://hjemli.net/git/
For a quick summary of the cache algorithm, the project README is here:
http://hjemli.net/git/cgit/view/?id=5917c37ce30b3f0a374c9fa376955f51f1d7bfbf
Enjoy!
--