Applications should be fast regardless of any cache system. However, sometimes we do need to cache data in order to optimise things and deliver a fast response to the clients.
This talk covers the different types of cache offered Doctrine ORM (metadata, query, result set, and second level cache), how they work together with the Unit of Work and what we should know before caching all the things.
9. “ a hardware or software component
that stores data so future requests for
that data can be served faster; the data
stored in a cache might be the result of
an earlier computation, or the duplicate
of data stored elsewhere.
Cache (computing) - Wikipedia
50. $query = ‘SELECT m FROM Message m WHERE m.user = :user';
$messages = $entityManager->createQuery($query)
->setParameter('user', 1)
->setCacheable(true)
->getResult();