Skip to content
Snippets Groups Projects
Commit 460f8e0d authored by Demian Katz's avatar Demian Katz
Browse files

Inject configurations into cache manager.

parent d23e4985
No related merge requests found
......@@ -141,6 +141,12 @@ $config = array(
$sm->get('VuFind\Config')->get('config')
);
},
'VuFind\CacheManager' => function ($sm) {
return new \VuFind\Cache\Manager(
$sm->get('VuFind\Config')->get('config'),
$sm->get('VuFind\Config')->get('searches')
);
},
'VuFind\Cart' => function ($sm) {
$config = $sm->get('VuFind\Config')->get('config');
$active = isset($config->Site->showBookBag)
......@@ -266,7 +272,6 @@ $config = array(
},
),
'invokables' => array(
'VuFind\CacheManager' => 'VuFind\Cache\Manager',
'VuFind\RecordLoader' => 'VuFind\Record\Loader',
'VuFind\SessionManager' => 'Zend\Session\SessionManager',
'VuFind\WorldCatUtils' => 'VuFind\Connection\WorldCatUtils',
......
......@@ -26,7 +26,7 @@
* @link http://www.vufind.org Main Page
*/
namespace VuFind\Cache;
use VuFind\Config\Reader as ConfigReader, Zend\Cache\StorageFactory;
use Zend\Cache\StorageFactory, Zend\Config\Config;
/**
* VuFind Cache Manager
......@@ -71,12 +71,12 @@ class Manager
/**
* Constructor
*
* @param Config $config Main VuFind configuration
* @param Config $searchConfig Search configuration
*/
public function __construct()
public function __construct(Config $config, Config $searchConfig)
{
// Get global cache options
$config = ConfigReader::getConfig('config');
// $config and $config->Cache are Zend\Config\Config objects
// $cache is created immutable, so get the array, it will be modified
// downstream.
......@@ -95,9 +95,8 @@ class Manager
$this->createFileCache('language', $cacheBase . 'languages');
// Set up search specs cache based on config settings:
$config = ConfigReader::getConfig('searches');
$searchCacheType = isset($config->Cache->type)
? $config->Cache->type : false;
$searchCacheType = isset($searchConfig->Cache->type)
? $searchConfig->Cache->type : false;
switch ($searchCacheType) {
case 'APC':
$this->createAPCCache('searchspecs');
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment