Index: branches/RC/core/kernel/processors/tag_processor.php =================================================================== diff -u -N -r9969 -r10610 --- branches/RC/core/kernel/processors/tag_processor.php (.../tag_processor.php) (revision 9969) +++ branches/RC/core/kernel/processors/tag_processor.php (.../tag_processor.php) (revision 10610) @@ -59,6 +59,22 @@ } } + function FormCacheKey($tag, $params, $prefix) + { + $k = $this->Application->Parser->TemplateName; + $k .= $prefix.'_'.$tag; + foreach (array('m_cat_id','m_cat_page','m_lang','m_theme') as $m_var) { + $params[$m_var] = $this->Application->GetVar($m_var); + } + + ksort($params); + foreach ($params as $p => $v) { + $k .= "$p=$v&"; + } + + return md5($k); + } + function ProcessParsedTag($tag, $params, $prefix, $file='unknown', $line=0) { $Method = $tag; @@ -69,7 +85,14 @@ $backup_prefix = $this->Prefix; $backup_special = $this->Special; - + + if ($this->Application->ConfigValue('SystemTagCache') && isset($params['cache_timeout'])) { + if ($res = $this->Application->CacheGet($this->FormCacheKey($tag, $params, $prefix))) { + return $res; + } + } + + $original_params = $params; $flag_values = $this->PreparePostProcess($params); // pass_params for non ParseBlock tags :) @@ -82,7 +105,11 @@ $this->Prefix = $backup_prefix; $this->Special = $backup_special; - return $this->PostProcess($ret, $flag_values); + $ret = $this->PostProcess($ret, $flag_values); + if ($this->Application->ConfigValue('SystemTagCache') && $flag_values['cache_timeout'] && isset($this->Application->Memcached)) { + $this->Application->CacheSet($this->FormCacheKey($tag, $original_params, $prefix), $ret, $flag_values['cache_timeout']); + } + return $ret; } else { list ($ret, $tag_found) = $this->processAggregatedTag($tag, $params, $prefix, $file, $line); @@ -134,7 +161,7 @@ function PreparePostProcess(&$params) { - $flags = Array('js_escape', 'equals_to', 'result_to_var', 'pass_params', 'html_escape', 'strip_nl', 'trim'); + $flags = Array('js_escape', 'equals_to', 'result_to_var', 'pass_params', 'html_escape', 'strip_nl', 'trim', 'cache_timeout'); $flag_values = Array(); foreach ($flags as $flag_name) {