Document objectcache option
Document objectcache option

--- a/config/gitphp.conf.defaults.php
+++ b/config/gitphp.conf.defaults.php
@@ -258,11 +258,21 @@
 
 /*
  * cache
- * Turns on caching. If in doubt, leave it off
+ * Turns on template caching. If in doubt, leave it off
  * You will need to create a directory 'cache' and make it
  * writable by the server
  */
 $gitphp_conf['cache'] = false;
+
+/*
+ * objectcache
+ * Turns on object caching.  This caches immutable pieces of
+ * data from the git repository.  You will need to create a
+ * directory 'cache' and make it writable by the server.
+ * This can be used in place of the template cache, or
+ * in addition to it for the maximum benefit.
+ */
+$gitphp_conf['objectcache'] = false;
 
 /*
  * cacheexpire
@@ -289,11 +299,20 @@
 $gitphp_conf['cachelifetime'] = 3600;
 
 /*
+ * objectcachelifetime
+ * Sets how long git objects will be cached, in seconds
+ * The object cache only stores immutable objects from
+ * the git repository, so there's no harm in setting
+ * this to a high number.  Set to -1 to never expire.
+ */
+$gitphp_conf['objectcachelifetime'] = 86400;
+
+/*
  * memcache
  * Enables memcache support for caching data, instead of
  * Smarty's standard on-disk cache.
- * Only applies if cache = true.  Requires either the
- * Memcached or Memcache PHP extensions.
+ * Only applies if cache = true or objectcache = true (or both)
+ * Requires either the Memcached or Memcache PHP extensions.
  * This is an array of servers.  Each server is specified as an
  * array.
  * Index 0 (required): The server hostname/IP

--- a/config/gitphp.conf.php.example
+++ b/config/gitphp.conf.php.example
@@ -20,11 +20,20 @@
 
 /*
  * cache
- * Turns on caching. If in doubt, leave it off
+ * Turns on template caching. If in doubt, leave it off
  * You will need to create a directory 'cache' and make it
  * writable by the server
  */
 //$gitphp_conf['cache'] = true;
 
+/*
+ * objectcache
+ * Turns on object caching.  This caches immutable pieces of
+ * data from the git repository.  You will need to create a
+ * directory 'cache' and make it writable by the server.
+ * This can be used in place of the template cache, or
+ * in addition to it for the maximum benefit.
+ */
+//$gitphp_conf['objectcache'] = true;
 
 

file:a/doc/README -> file:b/doc/README
--- a/doc/README
+++ b/doc/README
@@ -79,6 +79,16 @@
 blobs and snapshots, for the number of seconds specified in the
 'cachelifetime' config key.  You will need to set the "cache" directory
 writable by the server, as with the templates_c directory above.
+
+Gitphp can also cache immutable objects from the git repository, by setting
+'objectcache' to true.  These cached objects can be reused on multiple
+pages.  The 'objectcachelifetime' config key controls how long they are
+cached.  Since these objects don't ever change in the git repository, they
+can be cached for significantly longer than templates can (or in theory,
+forever).  This option can be used on its own, or in addition to the regular
+template 'cache' option for the maximum benefit.  This option also requires
+the "cache" directory writable by the server, as above.
+
 The 'cacheexpire' key is recommended for most users.  With this option on,
 gitphp will attempt to keep the cache in sync by automatically expiring any
 cached pages that are older than the most recent commit, on any branch.
@@ -90,23 +100,30 @@
 before and after a commit (eg page 1 of the shortlog shows the most recent
 commit but page 1 of the log was cached a while ago and doesn't show the
 most recent commit).
+
 However, if your project is so active that commits are constantly coming in
 and invalidating the cache, rendering it useless, it would be better to
 turn cache expiration off and just set a really short cache lifetime of
 a few seconds.  In other words:
 
 Most users:
-* Set 'cacheexpire' to TRUE
-* Set 'cachelifetime' high, 3600 seconds (1 hour) or more.  -1 means
-  cache forever
+* Set 'cache' to TRUE
+* Set 'objectcache' to TRUE
+* Set 'cacheexpire' to TRUE (this is the default)
+* Set 'cachelifetime' high, 3600 seconds (1 hour) or more. (3600 is the default)
+* Set 'objectcachelifetime' even higher, eg 86400 seconds or more.  (86400 is
+  the default)
 
 These are the defaults.
 
 Extremely active projects, with commits every few seconds, or advanced
 users that know exactly how often commits come in and want to save
 the performance of the expiration check:
+* Set 'cache' to TRUE
+* Set 'objectcache' to TRUE
 * Set 'cacheexpire' to FALSE
 * Set 'cachelifetime' low, between 5-10 seconds.
+* Set 'objectcachelifetime' high, 86400 seconds or more.  (86400 is the default)
 
 If you ever run into problems with your cache not syncing correctly, or
 showing out of date information, you can use the 'expire' action to force

comments