コード例 #1
0
ファイル: SessionMemcache.class.php プロジェクト: jyht/v5
 public function run()
 {
     $options = C("SESSION_OPTIONS");
     $this->memcache = new Memcache();
     $this->memcache->connect($options['host'], $options['port'], 2.5);
     session_set_save_handler(array(&$this, "open"), array(&$this, "close"), array(&$this, "read"), array(&$this, "write"), array(&$this, "destroy"), array(&$this, "gc"));
 }
コード例 #2
0
ファイル: RedisHandler.php プロジェクト: houdunwang/hdphp
 public function connect()
 {
     $config = C('session.redis');
     $this->redis = new Redis();
     $this->redis->connect($config['host'], $config['port']);
     if (!empty($config['password'])) {
         $this->redis->auth($config['password']);
     }
     $this->redis->select((int) $config['database']);
 }
コード例 #3
0
 function __construct()
 {
     $config = C("SESSION_REDIS");
     $this->redis = new Redis();
     $this->redis->connect($config['host'], $config['port'], 2.5);
     if (!empty($config['password'])) {
         $this->redis->auth($config['password']);
     }
     $this->redis->select((int) $config['Db']);
 }
コード例 #4
0
 /**
  * @see	\herosphp\session\interfaces\ISession::start().
  */
 public static function start($config = NULL)
 {
     self::$handler = new \Redis();
     self::$handler->connect($config['host'], $config['port']);
     self::$config = $config;
     if (!$config['gc_maxlifetime']) {
         self::$config['gc_maxlifetime'] = ini_get('session.gc_maxlifetime');
     }
     session_set_save_handler(array(__CLASS__, 'open'), array(__CLASS__, 'close'), array(__CLASS__, 'read'), array(__CLASS__, 'write'), array(__CLASS__, 'destroy'), array(__CLASS__, 'gc'));
     session_start();
 }
コード例 #5
0
ファイル: Redis.php プロジェクト: ChenHuaPHP/ZOLshop
 public function make()
 {
     $config = C('session.redis');
     $this->redis = new Redis();
     $this->redis->connect($config['host'], $config['port']);
     if (!empty($config['password'])) {
         $this->redis->auth($config['password']);
     }
     $this->redis->select((int) $config['database']);
     session_set_save_handler(array(&$this, "open"), array(&$this, "close"), array(&$this, "read"), array(&$this, "write"), array(&$this, "destroy"), array(&$this, "gc"));
 }
コード例 #6
0
ファイル: SessionRedis.class.php プロジェクト: hdbaiyu/HDPHP
 function __construct()
 {
     $config = C("SESSION_REDIS");
     $this->redis = new Redis();
     $this->redis->connect($config['host'], $config['port'], 2.5);
     if (!empty($config['password'])) {
         $this->redis->auth($config['password']);
     }
     $this->redis->select((int) $config['db']);
     session_set_save_handler(array(&$this, "open"), array(&$this, "close"), array(&$this, "read"), array(&$this, "write"), array(&$this, "destroy"), array(&$this, "gc"));
 }
コード例 #7
0
ファイル: MemSession.class.php プロジェクト: cqmyg/herosphp2
 /**
  * @see	\herosphp\session\interfaces\ISession::start().
  */
 public static function start($config = NULL)
 {
     if (!$config) {
         if (APP_DEBUG) {
             E("config should be pass to app");
         }
     }
     self::$handler = new \Memcache();
     self::$handler->connect($config['host'], $config['port']) or E("could not to connect the memcache server!");
     self::$config = $config;
     if (!$config['gc_maxlifetime']) {
         self::$config['gc_maxlifetime'] = ini_get('session.gc_maxlifetime');
     }
     session_set_save_handler(array(__CLASS__, 'open'), array(__CLASS__, 'close'), array(__CLASS__, 'read'), array(__CLASS__, 'write'), array(__CLASS__, 'destroy'), array(__CLASS__, 'gc'));
     session_start();
 }
コード例 #8
0
 public function __construct($samebugKey)
 {
     /** Set up Samebug Application Key
      * @var string $samebugKey
      */
     $this->samebugKey = $samebugKey;
     /** Set up connector class and create a new instance.
      * @var string $connectorClass
      */
     $connectorClass = "Samebug\\{$this->connectorType}";
     /** Set up the connection.
      * @var \Samebug\SamebugRecorderConnectorCurl $connector
      */
     $this->connector = new $connectorClass();
     $this->connector->setHost($this->connectorHost);
     $this->connector->setPlatform(self::SAMEBUG_PLATFORM);
     $this->connector->setProtocolVersion(self::SAMEBUG_PROTOCOL_VERSION);
     $this->connector->setKey($samebugKey);
     $this->connector->connect();
 }
コード例 #9
0
ファイル: webservice.php プロジェクト: barraemme/waterwall
 /**
  * Connect the Behavior to a new URL
  *
  * @param string $url The URL to connect to.
  * @param array $options Options Array for the new connection. 
  * @return bool success
  **/
 function serviceConnect(&$Model, $url, $options = array())
 {
     $options = array_merge($this->__settings[$Model->name], $options);
     $path = $this->_setPath($url);
     $options['host'] = $path['host'];
     if ($this->Socket === null) {
         $this->Socket = new CakeSocket($options);
     } else {
         if ($this->Socket->connected && $this->__settings[$Model->name]['persistent'] == false) {
             $this->serviceDisconnect($Model);
         }
         $this->Socket->config = $options;
     }
     $this->__setInfo(array('connection' => $options, 'host' => $path['host'], 'path' => $path['path']));
     return $this->Socket->connect();
 }
コード例 #10
0
 /**
  * Connect to database
  *
  * Try to connect to the database provided by LumineConfiguration object.<br />
  * If its already connect, use the current connection
  * @return void
  * @access Public
  */
 function connect()
 {
     LumineLog::logger(1, 'Método <strong>connect</strong> invocado por ' . get_class($this), __FILE__, __LINE__);
     if ($this->oTable == null) {
         LumineLog::logger(3, 'Entidade não encontrada: ' . get_class($this), __FILE__, __LINE__);
         exit;
     }
     if ($this->conn == null) {
         $this->conn =& $this->oTable->config->conn;
     }
     if ($this->conn->IsConnected() == false) {
         LumineLog::logger(1, 'Criando uma nova conexão em ' . get_class($this), __FILE__, __LINE__);
         $c = $this->oTable->config->config;
         $this->conn->connect($c['host'], $c['user'], $c['password'], $c['database']);
     } else {
         LumineLog::logger(1, 'Usando conexão cacheada', __FILE__, __LINE__);
     }
 }
コード例 #11
0
 function __construct()
 {
     $config = C("SESSION_MEMCACHE");
     $this->memcache = new Memcache();
     $this->memcache->connect($config['host'], $config['port'], 2.5);
 }