aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Repository/EntryRepository.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/Wallabag/CoreBundle/Repository/EntryRepository.php')
-rw-r--r--src/Wallabag/CoreBundle/Repository/EntryRepository.php17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/Wallabag/CoreBundle/Repository/EntryRepository.php b/src/Wallabag/CoreBundle/Repository/EntryRepository.php
index e9351d85..86bce545 100644
--- a/src/Wallabag/CoreBundle/Repository/EntryRepository.php
+++ b/src/Wallabag/CoreBundle/Repository/EntryRepository.php
@@ -3,6 +3,7 @@
3namespace Wallabag\CoreBundle\Repository; 3namespace Wallabag\CoreBundle\Repository;
4 4
5use Doctrine\ORM\EntityRepository; 5use Doctrine\ORM\EntityRepository;
6use Doctrine\ORM\Query;
6use Pagerfanta\Adapter\DoctrineORMAdapter; 7use Pagerfanta\Adapter\DoctrineORMAdapter;
7use Pagerfanta\Pagerfanta; 8use Pagerfanta\Pagerfanta;
8use Wallabag\CoreBundle\Entity\Tag; 9use Wallabag\CoreBundle\Entity\Tag;
@@ -279,4 +280,20 @@ class EntryRepository extends EntityRepository
279 280
280 return $qb->getQuery()->getSingleScalarResult(); 281 return $qb->getQuery()->getSingleScalarResult();
281 } 282 }
283
284 /**
285 * Enable cache for a query
286 *
287 * @param Query $query
288 *
289 * @return Query
290 */
291 public function enableCache(Query $query)
292 {
293 $query->useQueryCache(true);
294 $query->useResultCache(true);
295 $query->setResultCacheLifetime(5);
296
297 return $query;
298 }
282} 299}