From b7656b9839298670f97622fe9a6794057545a55d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuli=20Sillanp=C3=A4=C3=A4?= <samuli.sillanpaa@helsinki.fi> Date: Fri, 1 Nov 2019 12:38:41 -0400 Subject: [PATCH] Add support for prefixing Solr tree data cache filenames. - Makes subclassing possible without cache collisions. --- .../src/VuFind/Hierarchy/TreeDataSource/Solr.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/module/VuFind/src/VuFind/Hierarchy/TreeDataSource/Solr.php b/module/VuFind/src/VuFind/Hierarchy/TreeDataSource/Solr.php index 1fe4a1277dd..2aee5359681 100644 --- a/module/VuFind/src/VuFind/Hierarchy/TreeDataSource/Solr.php +++ b/module/VuFind/src/VuFind/Hierarchy/TreeDataSource/Solr.php @@ -80,6 +80,13 @@ class Solr extends AbstractBase */ protected $batchSize = 1000; + /** + * Hierarchy cache file prefix. + * + * @var string + */ + protected $cachePrefix = null; + /** * Constructor. * @@ -265,7 +272,9 @@ class Solr extends AbstractBase $cacheTemplate = 'tree_%s' ) { $cacheFile = (null !== $this->cacheDir) - ? $this->cacheDir . '/' . sprintf($cacheTemplate, urlencode($id)) + ? $this->cacheDir . '/' + . ($this->cachePrefix ? "{$this->cachePrefix}_" : '') + . sprintf($cacheTemplate, urlencode($id)) : false; $useCache = isset($options['refresh']) ? !$options['refresh'] : true; -- GitLab