Browse Source

Remove persistent cache.

It didn't actually increase performance at all. In some cases it would
slow things down as the filesystem was used.
mark_story 11 years ago
parent
commit
283bcd028d
2 changed files with 2 additions and 50 deletions
  1. 1 3
      src/View/Helper/StringTemplateTrait.php
  2. 1 47
      src/View/StringTemplate.php

+ 1 - 3
src/View/Helper/StringTemplateTrait.php

@@ -64,7 +64,7 @@ trait StringTemplateTrait {
 	public function templater() {
 		if (empty($this->_templater)) {
 			$class = $this->config('templateClass') ?: 'Cake\View\StringTemplate';
-			$this->_templater = new $class([], str_replace('\\', '_', __CLASS__));
+			$this->_templater = new $class();
 
 			$templates = $this->config('templates');
 			if ($templates) {
@@ -74,10 +74,8 @@ trait StringTemplateTrait {
 				} else {
 					$this->_templater->add($templates);
 				}
-				$this->_templater->writeCache();
 			}
 		}
-
 		return $this->_templater;
 	}
 

+ 1 - 47
src/View/StringTemplate.php

@@ -14,7 +14,6 @@
  */
 namespace Cake\View;
 
-use Cake\Cache\Cache;
 use Cake\Configure\Engine\PhpConfig;
 use Cake\Core\InstanceConfigTrait;
 
@@ -65,60 +64,15 @@ class StringTemplate {
 	protected $_compiled = [];
 
 /**
- * The persistent cache key for templates.
- *
- * @var string
- */
-	protected $_cacheKey;
-
-/**
  * Constructor.
  *
  * @param array $config A set of templates to add.
- * @param string $cacheKey The cache key to load templates from
  */
-	public function __construct(array $config = [], $key = null) {
-		if ($key) {
-			$this->_cacheKey = $key;
-			$this->loadCache();
-		}
+	public function __construct(array $config = []) {
 		$this->add($config);
 	}
 
 /**
- * Loads templates and compiled results from the persistent cache.
- *
- * @return void
- */
-	public function loadCache() {
-		if (!$this->_cacheKey) {
-			return;
-		}
-		$results = Cache::read($this->_cacheKey, '_cake_core_');
-		if (!$results) {
-			return;
-		}
-		$this->_templates = $results['templates'];
-		$this->_compiled = $results['compiled'];
-	}
-
-/**
- * Save templates to the persistent cache.
- *
- * @return void
- */
-	public function writeCache() {
-		if (empty($this->_cacheKey)) {
-			return;
-		}
-		$data = [
-			'templates' => $this->_config,
-			'compiled' => $this->_compiled
-		];
-		Cache::write($this->_cacheKey, '_cake_core_');
-	}
-
-/**
  * Push the current templates into the template stack.
  *
  * @return void