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