better caching of attributes for $cacheable=false-plugins

This commit is contained in:
messju
2003-08-07 11:35:46 +00:00
parent 576205c52b
commit a0b874850a
2 changed files with 25 additions and 1 deletions

View File

@@ -1999,6 +1999,30 @@ class Smarty
}
/**
* get or set an array of cached attributes for function that is
* not cacheable
* @return array
*/
function &_smarty_cache_attrs($cache_serial, $count) {
$_cache_attrs =& $this->_cache_info['cache_attrs'][$cache_serial][$count];
if ($this->_cache_including) {
/* return next set of cache_attrs */
$_return =& current($_cache_attrs);
next($_cache_attrs);
return $_return;
} else {
/* add a reference to a new set of cache_attrs */
$_cache_attrs[] = array();
return $_cache_attrs[count($_cache_attrs)-1];
}
}
/**
* wrapper for include() retaining $this
* @return mixed

View File

@@ -1294,7 +1294,7 @@ class Smarty_Compiler extends Smarty {
/* we have a list of parameters that should be cached */
$_cache_attrs = $this->_plugins[$type][$name][5];
$_count = $this->_cache_attrs_count++;
$cache_code = "\$_cache_attrs =& \$this->_cache_info['cache_attrs']['$this->_cache_serial'][$_count];";
$cache_code = "\$_cache_attrs =& \$this->_smarty_cache_attrs('$this->_cache_serial','$_count');";
} else {
/* no parameters are cached */