I am working on a Symfony2 project using Doctrine. I want to optimize the performance of the API by adding a cache to the requests.
I examined several options, for example:
- symfony annotation cache
- Doctrine Cache
- Memcache
Not sure which one I should go with, but it seems to me that caching data at the Doctrine level would be most appropriate.
Saying that I want someone to help me or give me guidance on setting up the Doctrine cache and explain how it works.
Ie I have this request:
class QueryFactory protected $connect; public function __construct(Connection $connection) { $this->connect = $connection; } private function myQuery() { return $this->connect->createQueryBuilder() ->select('user_id') ->from('users', 'u') ->where('u.user_id = 2'); } }
How to add cache to this request? Is there any Doctrine library that I need to add any thing I need to use ?
source share