language: en
rss_limit: 50
reading_speed: 1
+ cache_lifetime: 10
wallabag_import:
allow_mimetypes: ['application/octet-stream', 'application/json', 'text/plain']
transport: smtp
host: 'localhost'
port: 1025
+
+# If you want to use cache for queries used in WallabagExtension
+# Uncomment the following lines
+#doctrine:
+# orm:
+# metadata_cache_driver: apcu
+# result_cache_driver: apcu
+# query_cache_driver: apcu
->end()
->scalarNode('paypal_url')
->end()
+ ->integerNode('cache_lifetime')
+ ->defaultValue(10)
+ ->end()
->end()
;
$container->setParameter('wallabag_core.reading_speed', $config['reading_speed']);
$container->setParameter('wallabag_core.version', $config['version']);
$container->setParameter('wallabag_core.paypal_url', $config['paypal_url']);
+ $container->setParameter('wallabag_core.cache_lifetime', $config['cache_lifetime']);
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('services.yml');
class EntryRepository extends EntityRepository
{
+ private $lifeTime;
+
/**
* Return a query builder to used by other getBuilderFor* method.
*
return $qb->getQuery()->getSingleScalarResult();
}
+ public function setLifeTime($lifeTime)
+ {
+ $this->lifeTime = $lifeTime;
+ }
+
/**
- * Enable cache for a query
+ * Enable cache for a query.
*
* @param Query $query
*
{
$query->useQueryCache(true);
$query->useResultCache(true);
- $query->setResultCacheLifetime(5);
+ $query->setResultCacheLifetime($this->lifeTime);
return $query;
}
factory: [ "@doctrine.orm.default_entity_manager", getRepository ]
arguments:
- WallabagCoreBundle:Entry
+ calls:
+ - [ setLifeTime, [ "%wallabag_core.cache_lifetime%" ] ]
wallabag_core.tag_repository:
class: Wallabag\CoreBundle\Repository\TagRepository