Exemplo n.º 1
0
<?php

if (empty(\Swoole::$php->config['cache']['master'])) {
    Swoole::$php->config['cache']['master'] = array('type' => 'FileCache', 'cache_dir' => WEBPATH . '/cache/filecache');
}
$cache = Swoole\Factory::getCache('master');
Exemplo n.º 2
0
<?php

$configs = \Swoole::$php->config['cache'];
if (empty($configs[\Swoole::$php->factory_key])) {
    throw new Swoole\Exception\Factory("cache->" . \Swoole::$php->factory_key . " is not found.");
}
return Swoole\Factory::getCache(Swoole::$php->factory_key);
Exemplo n.º 3
0
<?php

if (!empty(Swoole::$php->config['session']['use_swoole_session']) or defined('SWOOLE_SERVER')) {
    if (empty(Swoole::$php->config['cache']['session'])) {
        $cache = Swoole::$php->cache;
    } else {
        $cache = Swoole\Factory::getCache('session');
    }
    $session = new Swoole\Session($cache);
    $session->use_php_session = false;
} else {
    $session = new Swoole\Session();
}
return $session;