From 2ff63e303a24e23aff57388a52e381dffebd97a9 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Mon, 9 Jan 2006 08:44:16 +0000 Subject: [PATCH] Adding in some extra function goodness --- includes/cachev.php | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/includes/cachev.php b/includes/cachev.php index ec85202..ba714be 100644 --- a/includes/cachev.php +++ b/includes/cachev.php @@ -57,6 +57,12 @@ class cacheV */ var $count; + /** + * Memcache for all fetched revisions so we don't have to query-dupe + * @var array + */ + var $memcache = array(); + // ################################################################### /** * Constructor: initialies the registry @@ -78,6 +84,28 @@ class cacheV $this->hash = md5($this->registry->repos->fetch_path($this->registry->paths->repos)); } + // ################################################################### + /** + * Returns a specific log entry + * + * @access public + * + * @param integer Revision number + * + * @return array Complete revision/commit entry + */ + function fetch_revision($revision) + { + $revision = $this->registry->clean($revision, TYPE_UINT); + + if (!isset($this->memcache["$revision"])) + { + $this->memcache["$revision"] = $this->registry->db->query_first("SELECT * FROM {$this->hash} WHERE revision = $revision"); + } + + return $this->memcache["$revision"]; + } + // ################################################################### /** * Checks to see if it's necessary to rebuild the cacheV table for the -- 2.22.5