mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 18:34:27 +02:00
better caching of attributes for $cacheable=false-plugins
This commit is contained in:
@@ -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
|
* wrapper for include() retaining $this
|
||||||
* @return mixed
|
* @return mixed
|
||||||
|
@@ -1294,7 +1294,7 @@ class Smarty_Compiler extends Smarty {
|
|||||||
/* we have a list of parameters that should be cached */
|
/* we have a list of parameters that should be cached */
|
||||||
$_cache_attrs = $this->_plugins[$type][$name][5];
|
$_cache_attrs = $this->_plugins[$type][$name][5];
|
||||||
$_count = $this->_cache_attrs_count++;
|
$_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 {
|
} else {
|
||||||
/* no parameters are cached */
|
/* no parameters are cached */
|
||||||
|
Reference in New Issue
Block a user