$di->set('db', function () use ($config, $di) {
$connection = new DbAdapter($config->database->toArray());
$eventsManager = $di->getShared('eventsManager');
$eventsManager->attach('db:beforeQuery', function($event, $connection) {
return false;
});
$connection->setEventsManager($eventsManager);
return $connection;
});
I have this in my services, this code "catch" all queries, this is fine. But my goal is use global cache handler which will catch all queries and use them as keys in the cache system. Could someone make a suggestion regarding this?
Thanks