Source of file ExpressionLanguageParserCache.php
Size: 1,198 Bytes - Last Modified: 2021-12-24T06:50:57+00:00
/var/www/docs.ssmods.com/process/src/src/ExpressionLanguageParserCache.php
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 | <?php namespace Heyday\CacheInclude; use Psr\SimpleCache\CacheInterface; use SilverStripe\Core\Injector\Injector; use Symfony\Component\ExpressionLanguage\ParsedExpression; use Symfony\Component\ExpressionLanguage\ParserCache\ParserCacheInterface; class ExpressionLanguageParserCache implements ParserCacheInterface { /** * @var CacheInterface */ protected $cache; public function __construct() { $this->cache = Injector::inst()->get(CacheInterface::class . '.CacheInclude'); } /** * Saves an expression in the cache. * * @param string $key The cache key * @param ParsedExpression $expression A ParsedExpression instance to store in the cache * @throws \Psr\SimpleCache\InvalidArgumentException */ public function save($key, ParsedExpression $expression) { $this->cache->set($key, $expression); } /** * Fetches an expression from the cache. * * @param string $key The cache key * * @return ParsedExpression|null * @throws \Psr\SimpleCache\InvalidArgumentException */ public function fetch($key) { return $this->cache->get($key) ?: null; } } |