Вход Регистрация
Файл: symfony-2.7/src/Symfony/Bridge/Doctrine/ExpressionLanguage/DoctrineParserCache.php
Строк: 48
<?php

/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace SymfonyBridgeDoctrineExpressionLanguage;

use 
DoctrineCommonCacheCache;
use 
SymfonyComponentExpressionLanguageParsedExpression;
use 
SymfonyComponentExpressionLanguageParserCacheParserCacheInterface;

/**
 * @author Adrien Brault <adrien.brault@gmail.com>
 */
class DoctrineParserCache implements ParserCacheInterface
{
    
/**
     * @var Cache
     */
    
private $cache;

    public function 
__construct(Cache $cache)
    {
        
$this->cache $cache;
    }

    
/**
     * {@inheritdoc}
     */
    
public function fetch($key)
    {
        if (
false === $value $this->cache->fetch($key)) {
            return;
        }

        return 
$value;
    }

    
/**
     * {@inheritdoc}
     */
    
public function save($keyParsedExpression $expression)
    {
        
$this->cache->save($key$expression);
    }
}
Онлайн: 4
Реклама