Пример #1
0
 /**
  * @param string $host
  * @param mixed $port
  * @param string $prefix
  * @param mixed $lifetime
  */
 public function __construct($host, $port, $prefix, $lifetime)
 {
     parent::__construct(['servers' => [['host' => $host, 'port' => $port, 'weight' => 1]], 'client' => [], 'lifetime' => $lifetime, 'prefix' => $prefix]);
 }
Пример #2
0
 public function __construct(array $options = [])
 {
     $options = array_merge(Config::get('cache.drivers.memcached.options'), $options);
     parent::__construct($options);
 }
Пример #3
0
 public function getLifetime()
 {
     return parent::getLifetime();
 }
Пример #4
0
     return $assetManager;
 }, true);
 /**
  * Setting up the model cache
  */
 $di->set('modelsCache', function () use($di) {
     $memcacheConfig = $di->get('config')->get('memcache');
     $frontCache = new CacheFrontend(array('lifetime' => $memcacheConfig->lifetimeModels));
     return new Memcache($frontCache, array('servers' => array(array('host' => $memcacheConfig->host, 'port' => $memcacheConfig->port, 'weight' => 1)), 'client' => array(Memcached::OPT_PREFIX_KEY => $memcacheConfig->prefix)));
 }, true);
 /**
  * Start the session the first time some component request the session service
  */
 $di->set('session', function () use($di) {
     $memcacheConfig = $di->get('config')->get('memcache');
     $session = new Session(array('servers' => array(array('host' => $memcacheConfig->host, 'port' => $memcacheConfig->port, 'weight' => 1)), 'client' => array(), 'lifetime' => $memcacheConfig->lifetimeSession, 'prefix' => $memcacheConfig->prefix));
     $session->start();
     return $session;
 });
 /**
  * Setting up the flash service
  */
 $di->set('flash', function () {
     return new FlashSession(array('notice' => 'alert alert-info', 'success' => 'alert alert-success', 'warning' => 'alert alert-warning', 'error' => 'alert alert-danger'));
 });
 /**
  * Setting up custom Request object
  */
 $di->set('request', function () {
     return new RestRequest();
 });