Merge pull request #3366 from 4rthem/doctrine-metadata-cache

PHRAS-2953 #comment merge add doctrine metadata filesystem cache
This commit is contained in:
Nicolas Maillat
2020-02-27 10:50:24 +01:00
committed by GitHub
2 changed files with 11 additions and 7 deletions

View File

@@ -1573,9 +1573,9 @@ class V1Controller extends Controller
$options->setFirstResult((int)($request->get('offset_start') ?: 0));
$options->setMaxResults((int)$request->get('per_page') ?: 10);
$this->getSearchEngine()->resetCache();
$searchEngine = $this->getSearchEngine();
$search_result = $this->getSearchEngine()->query((string)$request->get('query'), $options);
$search_result = $searchEngine->query((string)$request->get('query'), $options);
$this->getUserManipulator()->logQuery($this->getAuthenticatedUser(), $search_result->getQueryText());
@@ -1583,12 +1583,12 @@ class V1Controller extends Controller
$collectionsReferencesByDatabox = $options->getCollectionsReferencesByDatabox();
foreach ($collectionsReferencesByDatabox as $sbid => $references) {
$databox = $this->findDataboxById($sbid);
$collectionsIds = array_map(function(CollectionReference $ref){return $ref->getCollectionId();}, $references);
$collectionsIds = array_map(function (CollectionReference $ref) {
return $ref->getCollectionId();
}, $references);
$this->getSearchEngineLogger()->log($databox, $search_result->getQueryText(), $search_result->getTotal(), $collectionsIds);
}
$this->getSearchEngine()->clearCache();
return $search_result;
}

View File

@@ -84,10 +84,14 @@ class DatabaseMetaProvider implements ServiceProviderInterface
$service = $app['phraseanet.cache-service'];
$config->setMetadataCacheImpl(
$service->factory('ORM_metadata', $app['orm.cache.driver'], $app['orm.cache.options'])
$app['orm.cache.factory.filesystem'](array(
'path' => $app['cache.path'].'/doctrine/metadata',
))
);
$config->setQueryCacheImpl(
$service->factory('ORM_query', $app['orm.cache.driver'], $app['orm.cache.options'])
$app['orm.cache.factory.filesystem'](array(
'path' => $app['cache.path'].'/doctrine/query',
))
);
$config->setResultCacheImpl(
$service->factory('ORM_result', $app['orm.cache.driver'], $app['orm.cache.options'])