mirror of
https://github.com/Mibew/mibew.git
synced 2025-01-31 13:24:41 +03:00
Use ephemeral cache during installation
This commit is contained in:
parent
2c9a6830c8
commit
2c0d88c4d5
@ -27,6 +27,7 @@ use Mibew\Routing\Router;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Config\FileLocator;
|
||||
|
||||
// Prepare router
|
||||
$file_locator = new FileLocator(array(MIBEW_FS_ROOT));
|
||||
$router = new Router(new RouteCollectionLoader($file_locator));
|
||||
$router->setOption(
|
||||
@ -34,7 +35,13 @@ $router->setOption(
|
||||
RouteCollectionLoader::ROUTES_CORE | RouteCollectionLoader::ROUTES_PLUGINS
|
||||
);
|
||||
|
||||
// Prepare files cache
|
||||
$cache_driver = new \Stash\Driver\FileSystem();
|
||||
$cache_driver->setOptions(array('path' => MIBEW_FS_ROOT . '/cache'));
|
||||
$cache = new \Stash\Pool($cache_driver);
|
||||
|
||||
$application = new Application($router, new AuthenticationManager());
|
||||
$application->setCache($cache);
|
||||
|
||||
// Process request
|
||||
$request = Request::createFromGlobals();
|
||||
|
@ -24,6 +24,7 @@ use Mibew\Asset\AssetManager;
|
||||
use Mibew\Asset\AssetManagerInterface;
|
||||
use Mibew\Authentication\AuthenticationManagerInterface;
|
||||
use Mibew\Authentication\AuthenticationManagerAwareInterface;
|
||||
use Mibew\Cache\CacheAwareInterface;
|
||||
use Mibew\Controller\ControllerResolver;
|
||||
use Mibew\EventDispatcher\EventDispatcher;
|
||||
use Mibew\EventDispatcher\Events;
|
||||
@ -47,7 +48,10 @@ use Symfony\Component\Routing\Exception\ResourceNotFoundException as ResourceNot
|
||||
/**
|
||||
* Incapsulates whole application
|
||||
*/
|
||||
class Application implements RouterAwareInterface, AuthenticationManagerAwareInterface
|
||||
class Application implements
|
||||
RouterAwareInterface,
|
||||
AuthenticationManagerAwareInterface,
|
||||
CacheAwareInterface
|
||||
{
|
||||
/**
|
||||
* @var RouterInterface|null
|
||||
@ -201,15 +205,20 @@ class Application implements RouterAwareInterface, AuthenticationManagerAwareInt
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an instance of Cache Pool related with the application.
|
||||
*
|
||||
* @return PoolInterface
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function getCache()
|
||||
public function setCache(PoolInterface $cache)
|
||||
{
|
||||
$this->cache = $cache;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getCache()
|
||||
{
|
||||
if (is_null($this->cache)) {
|
||||
$driver = new \Stash\Driver\FileSystem();
|
||||
$driver->setOptions(array('path' => MIBEW_FS_ROOT . '/cache'));
|
||||
$driver = new \Stash\Driver\Ephemeral();
|
||||
$this->cache = new \Stash\Pool($driver);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user