Skip to content

Instantly share code, notes, and snippets.

View shubaivan's full-sized avatar
🏠
Working from home

shubaivan shubaivan

🏠
Working from home
View GitHub Profile
@dmaicher
dmaicher / TagAwareQueryResultCache.php
Last active April 16, 2020 08:47
use symfony/cache 3.2 tag aware cache as Doctrine DBAL query result cache
<?php
use Doctrine\DBAL\Cache\QueryCacheProfile;
use Symfony\Component\Cache\Adapter\TagAwareAdapterInterface;
use Symfony\Component\Cache\CacheItem;
use Symfony\Component\Cache\DoctrineProvider;
class TagAwareQueryResultCache extends DoctrineProvider
{
/**
##
## How to install mcrypt in php7.2 / php7.3
## Linux / MacOS / OSX
##
## https://lukasmestan.com/install-mcrypt-extension-in-php7-2/
#
<?php
require_once 'vendor/autoload.php';
$expressionLang = new \Symfony\Component\Security\Core\Authorization\ExpressionLanguage(
new \Symfony\Component\Cache\Adapter\NullAdapter()
);
$iterations = 500000;
$rawExpression = "1 in [1, 2, 3, 4] and (1 == 2 or 1 > 2 or 'foo' in ['bar', 'foo'])";