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:
parent
0b0233b1ec
commit
b3f4a11a81
6 changed files with 24 additions and 2 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue