From 3ca157064825cb85c0c1a5c30291141b9ec4efa2 Mon Sep 17 00:00:00 2001 From: Demian Katz <demian.katz@villanova.edu> Date: Wed, 22 Aug 2012 14:53:34 -0400 Subject: [PATCH] Progress implementing caching; language caching temporarily disabled due to bug in Zend translator component. --- module/VuFind/src/VuFind/Config/Reader.php | 2 +- .../VuFind/src/VuFind/Controller/SearchController.php | 5 ++--- .../VuFind/src/VuFind/Controller/SummonController.php | 6 ++---- module/VuFind/src/VuFind/ILS/Driver/Aleph.php | 8 ++------ module/VuFind/src/VuFind/Translator/Translator.php | 11 +++++++---- 5 files changed, 14 insertions(+), 18 deletions(-) diff --git a/module/VuFind/src/VuFind/Config/Reader.php b/module/VuFind/src/VuFind/Config/Reader.php index 7caead0cd00..9b2427b454f 100644 --- a/module/VuFind/src/VuFind/Config/Reader.php +++ b/module/VuFind/src/VuFind/Config/Reader.php @@ -237,7 +237,7 @@ class Reader } } if ($cache) { - $cache->setItem($results, $key); + $cache->setItem($key, $results); } } self::$searchSpecs[$filename] = $results; diff --git a/module/VuFind/src/VuFind/Controller/SearchController.php b/module/VuFind/src/VuFind/Controller/SearchController.php index 566d3b906ab..38897ea7352 100644 --- a/module/VuFind/src/VuFind/Controller/SearchController.php +++ b/module/VuFind/src/VuFind/Controller/SearchController.php @@ -507,9 +507,8 @@ class SearchController extends AbstractSearch $params->setLimit(0); $results = new Results($params); - /* TODO: fix caching: - $cache->setItem($results, 'solrSearchHomeFacets'); - */ + $results->getResults(); // force processing for cache + $cache->setItem('solrSearchHomeFacets', $results); } return $results; } diff --git a/module/VuFind/src/VuFind/Controller/SummonController.php b/module/VuFind/src/VuFind/Controller/SummonController.php index 2c81ede96d8..e50665647ce 100644 --- a/module/VuFind/src/VuFind/Controller/SummonController.php +++ b/module/VuFind/src/VuFind/Controller/SummonController.php @@ -137,10 +137,8 @@ class SummonController extends AbstractSearch $params->setLimit(0); $results = new SummonResults($params); - $results->getResults(); - /* TODO: fix caching - $cache->setItem($results, 'summonSearchHomeFacets'); - */ + $results->getResults(); // force processing for cache + $cache->setItem('summonSearchHomeFacets', $results); } return $results; } diff --git a/module/VuFind/src/VuFind/ILS/Driver/Aleph.php b/module/VuFind/src/VuFind/ILS/Driver/Aleph.php index 2c472669935..9667400c69e 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/Aleph.php +++ b/module/VuFind/src/VuFind/ILS/Driver/Aleph.php @@ -320,19 +320,15 @@ class Aleph implements DriverInterface && isset($configArray['util']['tab_sub_library']) ) { if (isset($configArray['Cache']['type'])) { - /* TODO $manager = CacheManager::getInstance(); $cache = $manager->getCache($configArray['Cache']['type']); - $this->translator = $cache->load('alephTranslator'); - */ + $this->translator = $cache->getItem('alephTranslator'); } if ($this->translator == false) { $this->translator = new AlephTranslator($configArray); - /* TODO if (isset($cache)) { - $cache->save($this->translator, 'alephTranslator'); + $cache->setItem('alephTranslator', $this->translator); } - */ } } } diff --git a/module/VuFind/src/VuFind/Translator/Translator.php b/module/VuFind/src/VuFind/Translator/Translator.php index c3999679028..0136c9d34aa 100644 --- a/module/VuFind/src/VuFind/Translator/Translator.php +++ b/module/VuFind/src/VuFind/Translator/Translator.php @@ -26,7 +26,8 @@ * @link http://www.vufind.org Main Page */ namespace VuFind\Translator; -use VuFind\Translator\Loader\ExtendedIni as ExtendedIniLoader, +use VuFind\Cache\Manager as CacheManager, + VuFind\Translator\Loader\ExtendedIni as ExtendedIniLoader, Zend\I18n\Translator\TranslatorServiceFactory; /** @@ -92,9 +93,11 @@ class Translator $pluginManager = $translator->getPluginManager(); $pluginManager->setService('extendedini', new ExtendedIniLoader()); - // Set up language caching for better performance (TODO): - //$translator - // ->setCache(CacheManager::getInstance()->getCache('language')); + /* TODO -- uncomment this when Zend translator bug is fixed (RC5?): + // Set up language caching for better performance: + $translator + ->setCache(CacheManager::getInstance()->getCache('language')); + */ // Store the translator object in the VuFind Translator wrapper: self::setTranslator($translator); -- GitLab