mirror of
https://github.com/Mibew/mibew.git
synced 2024-11-15 08:34:11 +03:00
Implement cache for Plugin Manager
This commit is contained in:
parent
547efb38e4
commit
15dbe153f5
@ -33,7 +33,9 @@ $cache_factory->setOption('path', MIBEW_FS_ROOT . '/cache/stash');
|
||||
|
||||
// Run plugins
|
||||
if (get_maintenance_mode() === false) {
|
||||
PluginManager::getInstance()->loadPlugins($configs['plugins']);
|
||||
$plugin_manager = PluginManager::getInstance();
|
||||
$plugin_manager->setCache($cache_factory->getCache());
|
||||
$plugin_manager->loadPlugins($configs['plugins']);
|
||||
}
|
||||
|
||||
// Do the job.
|
||||
|
@ -43,7 +43,9 @@ $cache_factory->setOption('path', MIBEW_FS_ROOT . '/cache/stash');
|
||||
|
||||
// Run plugins
|
||||
if (get_maintenance_mode() === false) {
|
||||
PluginManager::getInstance()->loadPlugins($configs['plugins']);
|
||||
$plugin_manager = PluginManager::getInstance();
|
||||
$plugin_manager->setCache($cache_factory->getCache());
|
||||
$plugin_manager->loadPlugins($configs['plugins']);
|
||||
}
|
||||
|
||||
// The main route loader which loads nothig but works as a cache proxy for other
|
||||
|
@ -19,15 +19,18 @@
|
||||
|
||||
namespace Mibew\Plugin;
|
||||
|
||||
use Mibew\Cache\CacheAwareInterface;
|
||||
use Mibew\Plugin\Utils as PluginUtils;
|
||||
use Mibew\Maintenance\Utils as MaintenanceUtils;
|
||||
use Stash\Interfaces\PoolInterface;
|
||||
|
||||
/**
|
||||
* Manage plugins.
|
||||
*
|
||||
* Implements singleton pattern.
|
||||
*/
|
||||
class PluginManager
|
||||
class PluginManager implements
|
||||
CacheAwareInterface
|
||||
{
|
||||
/**
|
||||
* An instance of Plugin Manager class.
|
||||
@ -35,6 +38,11 @@ class PluginManager
|
||||
*/
|
||||
protected static $instance = null;
|
||||
|
||||
/**
|
||||
* @var PoolInterface|null
|
||||
*/
|
||||
protected $cache = null;
|
||||
|
||||
/**
|
||||
* Contains all loaded plugins
|
||||
*
|
||||
@ -56,6 +64,22 @@ class PluginManager
|
||||
return self::$instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setCache(PoolInterface $cache)
|
||||
{
|
||||
$this->cache = $cache;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getCache()
|
||||
{
|
||||
return $this->cache;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns plugin instance.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user