1
0
Fork 0
mirror of https://github.com/wallabag/wallabag.git synced 2025-10-15 19:42:08 +00:00

Store cache lifetime in config

This commit is contained in:
Nicolas Lœuillet 2016-09-03 14:02:50 +02:00
parent 0b0233b1ec
commit b3f4a11a81
No known key found for this signature in database
GPG key ID: 5656BE27E1E34D0A
6 changed files with 24 additions and 2 deletions

View file

@ -10,6 +10,8 @@ use Wallabag\CoreBundle\Entity\Tag;
class EntryRepository extends EntityRepository
{
private $lifeTime;
/**
* Return a query builder to used by other getBuilderFor* method.
*
@ -281,8 +283,13 @@ class EntryRepository extends EntityRepository
return $qb->getQuery()->getSingleScalarResult();
}
public function setLifeTime($lifeTime)
{
$this->lifeTime = $lifeTime;
}
/**
* Enable cache for a query
* Enable cache for a query.
*
* @param Query $query
*
@ -292,7 +299,7 @@ class EntryRepository extends EntityRepository
{
$query->useQueryCache(true);
$query->useResultCache(true);
$query->setResultCacheLifetime(5);
$query->setResultCacheLifetime($this->lifeTime);
return $query;
}