diff options
author | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2016-09-03 14:02:50 +0200 |
---|---|---|
committer | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2016-09-03 14:02:50 +0200 |
commit | b3f4a11a81b520b8dcc2bcebeeafea2cc0338a70 (patch) | |
tree | f9364b610019ddb41aad995e8c5e5c8b39faf1ca /src/Wallabag/CoreBundle/Repository/EntryRepository.php | |
parent | 0b0233b1ec8208be47c76856a4e317673927b21e (diff) | |
download | wallabag-b3f4a11a81b520b8dcc2bcebeeafea2cc0338a70.tar.gz wallabag-b3f4a11a81b520b8dcc2bcebeeafea2cc0338a70.tar.zst wallabag-b3f4a11a81b520b8dcc2bcebeeafea2cc0338a70.zip |
Store cache lifetime in config
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 | } |