$db->setEventsManager($eventManager); } return $db; }); $di->set('crypt', function () use($config) { $crypt = new Crypt(); $crypt->setKey($config->crypt->key); return $crypt; }); $di->setShared('redis', function () use($config) { $redis = new Redis(); $redis->open($config->redis->host, $config->redis->port); return $redis; }); $di->setShared('session', function () { $session = new RedisSessionAdapter(array('path' => 'tcp://127.0.0.1:6379?weight=1')); $session->start(); return $session; }); $di->set('router', function () { $router = new Router(); $router->add("/:controller/:action/:params", array('module' => 'frontend', 'controller' => 1, 'action' => 2, 'params' => 3)); $router->add("/admin/:controller/:action/:params", array('module' => 'backend', 'controller' => 1, 'action' => 2, 'params' => 3)); $router->add("/:controller/([a-z0-9:/+]+)/page:([0-9]+)", array('module' => 'frontend', 'controller' => 1, 'action' => 'index', 'params' => 2, 'page' => 3)); $router->add("/:controller/([0-9]+)", array('module' => 'frontend', 'controller' => 1, 'action' => 'detail', 'id' => 2)); $router->add("/", array('module' => 'frontend', 'controller' => 'index', 'action' => 'index')); return $router; }); try { $app = new Application($di); $app->registerModules(array('frontend' => array('className' => 'Pohome\\Frontend\\Module', 'path' => '../apps/frontend/Module.php'), 'backend' => array('className' => 'Pohome\\Backend\\Module', 'path' => '../apps/backend/Module.php')));
public function getLifetime() { return parent::getLifetime(); }
public function __construct(array $options = []) { $options = array_merge(Config::get('cache.drivers.redis.options'), $options); parent::__construct($options); $this->_redis = new RedisCache(new FrontendNone(), $options); }