diff options
Diffstat (limited to 'src/Wallabag/CoreBundle/Repository/EntryRepository.php')
-rw-r--r-- | src/Wallabag/CoreBundle/Repository/EntryRepository.php | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/Wallabag/CoreBundle/Repository/EntryRepository.php b/src/Wallabag/CoreBundle/Repository/EntryRepository.php index 86bce545..4b205f6e 100644 --- a/src/Wallabag/CoreBundle/Repository/EntryRepository.php +++ b/src/Wallabag/CoreBundle/Repository/EntryRepository.php | |||
@@ -10,6 +10,8 @@ use Wallabag\CoreBundle\Entity\Tag; | |||
10 | 10 | ||
11 | class EntryRepository extends EntityRepository | 11 | class EntryRepository extends EntityRepository |
12 | { | 12 | { |
13 | private $lifeTime; | ||
14 | |||
13 | /** | 15 | /** |
14 | * Return a query builder to used by other getBuilderFor* method. | 16 | * Return a query builder to used by other getBuilderFor* method. |
15 | * | 17 | * |
@@ -281,8 +283,13 @@ class EntryRepository extends EntityRepository | |||
281 | return $qb->getQuery()->getSingleScalarResult(); | 283 | return $qb->getQuery()->getSingleScalarResult(); |
282 | } | 284 | } |
283 | 285 | ||
286 | public function setLifeTime($lifeTime) | ||
287 | { | ||
288 | $this->lifeTime = $lifeTime; | ||
289 | } | ||
290 | |||
284 | /** | 291 | /** |
285 | * Enable cache for a query | 292 | * Enable cache for a query. |
286 | * | 293 | * |
287 | * @param Query $query | 294 | * @param Query $query |
288 | * | 295 | * |
@@ -292,7 +299,7 @@ class EntryRepository extends EntityRepository | |||
292 | { | 299 | { |
293 | $query->useQueryCache(true); | 300 | $query->useQueryCache(true); |
294 | $query->useResultCache(true); | 301 | $query->useResultCache(true); |
295 | $query->setResultCacheLifetime(5); | 302 | $query->setResultCacheLifetime($this->lifeTime); |
296 | 303 | ||
297 | return $query; | 304 | return $query; |
298 | } | 305 | } |