Inject cache and memorycache into projectlist
Inject cache and memorycache into projectlist

--- a/include/controller/ControllerBase.class.php
+++ b/include/controller/ControllerBase.class.php
@@ -196,6 +196,15 @@
 			$this->projectList = GitPHP_ProjectList::Instantiate(GITPHP_CONFIGDIR . 'gitphp.conf.php', true);
 		}
 
+		$this->projectList->SetMemoryCache(new GitPHP_MemoryCache($this->config->GetValue('objectmemory')));
+		if ($this->config->GetValue('objectcache')) {
+			$cache = new GitPHP_Cache();
+			$cache->SetServers($this->config->GetValue('memcache'));
+			$cache->SetEnabled(true);
+			$cache->SetLifetime($this->config->GetValue('objectcachelifetime'));
+			$this->projectList->SetCache($cache);
+		}
+
 		$this->projectList->SetExe($this->exe);
 
 		if ($this->log)

--- a/include/git/projectlist/ProjectListBase.class.php
+++ b/include/git/projectlist/ProjectListBase.class.php
@@ -114,15 +114,6 @@
 		}
 		if (!is_dir($this->projectRoot)) {
 			throw new GitPHP_InvalidDirectoryConfigurationException($this->projectRoot);
-		}
-
-		$this->memoryCache = new GitPHP_MemoryCache(GitPHP_Config::GetInstance()->GetValue('objectmemory'));
-
-		if (GitPHP_Config::GetInstance()->GetValue('objectcache')) {
-			$this->cache = new GitPHP_Cache();
-			$this->cache->SetServers(GitPHP_Config::GetInstance()->GetValue('memcache'));
-			$this->cache->SetEnabled(true);
-			$this->cache->SetLifetime(GitPHP_Config::GetInstance()->GetValue('objectcachelifetime'));
 		}
 	}
 

comments