<commit_before><?php
class Vps_Component_Output_Cache extends Vps_Component_Output_NoCache
{
    private $_cache;
    private $_toLoadHasContent = array();
    private $_toLoad = array();
    private $_toLoadPartial = array();

    public function setCache(Vps_Component_Cache $cache)
    {
        $this->_cache = $cache;
    }

    public function getCache()
    {
        if (!$this->_cache) {
            $this->_cache = Vps_Component_Cache::getInstance();
        }
        return $this->_cache;
    }

    public function render($component, $masterTemplate = false, array $plugins = array())
    {
        // Erste Komponente vorausladen
        $componentId = $this->getCache()->getCacheIdFromComponentId($component->componentId, $masterTemplate);
        $pageId = $component->getPage() ? $component->getPage()->componentId : '';
        $pageId = $this->getCache()->getCacheIdFromComponentId($pageId);
        $result = $this->getCache()->preload(array($componentId => $pageId));
        if (!$result) {
            $meta = array();
            foreach (Vpc_Abstract::getComponentClasses() as $componentClass) {
                $methods = get_class_methods($componentClass);
                if (in_array('getStaticCacheVars', $methods)) {
                    $vars = call_user_func(array($componentClass, 'getStaticCacheVars'));
                    foreach ($vars as $id => $var) {
                        $vars[$id]['component_class'] = $componentClass;
                        $vars[$id]['cache_id'] = null;
                        $vars[$id]['callback'] = null;
                    }
                    $meta = array_merge($meta, $vars);
                }
            }
            $this->getCache()->saveMeta($meta);
        }
        // Normal rendern<commit_msg>Und noch ein Fix für Caching<commit_after><?php
class Vps_Component_Output_Cache extends Vps_Component_Output_NoCache
{
    private $_cache;
    private $_toLoadHasContent = array();
    private $_toLoad = array();
    private $_toLoadPartial = array();

    public function setCache(Vps_Component_Cache $cache)
    {
        $this->_cache = $cache;
    }

    public function getCache()
    {
        if (!$this->_cache) {
            $this->_cache = Vps_Component_Cache::getInstance();
        }
        return $this->_cache;
    }

    public function render($component, $masterTemplate = false, array $plugins = array())
    {
        // Erste Komponente vorausladen
        $componentId = $this->getCache()->getCacheIdFromComponentId($component->componentId, $masterTemplate);
        $pageId = $component->getPage() ? $component->getPage()->componentId : '';
        $pageId = $this->getCache()->getCacheIdFromComponentId($pageId);
        $result = $this->getCache()->preload(array($componentId => $pageId));
        if (!$result) {
            $meta = array();
            foreach (Vpc_Abstract::getComponentClasses() as $componentClass) {
                $methods = get_class_methods($componentClass);
                if (in_array('getStaticCacheVars', $methods)) {
                    $vars = call_user_func(array($componentClass, 'getStaticCacheVars'));
                    foreach ($vars as $id => $m) {
                        if ($m['model'] instanceof Vps_Model_Db) $m['model'] = get_class($m['model']->getTable());
                        if ($m['model'] instanceof Vps_Model_Abstract) $m['model'] = get_class($m['model']);
                        $vars[$id]['model'] = $m['model'];
                        $vars[$id]['component_class'] = $componentClass;
                        $vars[$id]['cache_id'] = null;
                        $vars[$id]['callback'] = null;
                    }
                    $meta = array_merge($meta, $vars);
                }
            }
            $this->getCache()->saveMeta($meta);
        }
        // Normal rendern
{'fraction_non_alphanumeric': 0.14460020768431983, 'fraction_numerical': 0.0, 'mean_word_length': 2.2054908485856903, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 40, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5604268', 'n_tokens_mistral': 1045, 'n_tokens_neox': 1027, 'n_words': 190}