public function __construct($timestamp, $options = '') { $this->log = Zc::getLog('cache/apc_cache.log'); if (!function_exists('apc_cache_info') || apc_cache_info() === false) { $this->log->info("apc module cound not found or disable"); $this->conntected = false; } else { $this->conntected = true; } $this->options = array('expire' => 3600); if (!empty($options)) { $this->options = array_merge($this->options, $options); } $this->timestamp = $timestamp; }
public function __construct($timestamp, $options = '') { $this->log = Zc::getLog('cache/file_cache.log'); $this->options = array('temp' => G_CACHING_CACHEFS_DIRECTORY, 'expire' => 3600, 'use_subdir' => true, 'subdir_level' => 2, 'cache_data_check' => false, 'cache_data_compress' => false); if (!empty($options)) { $this->options = array_merge($this->options, $options); } if (substr($this->options['temp'], -1) != '/') { $this->options['temp'] .= '/'; } $this->timestamp = $timestamp; $this->options['temp'] .= $this->timestamp . '/'; $this->init(); $this->conntected = is_dir($this->options['temp']) && is_writeable($this->options['temp']); }
public function __construct($timestamp, $options = '') { if (!extension_loaded('memcache')) { $this->conntected = false; return; } $this->log = Zc::getLog('cache/memcache_cache.log'); $this->timestamp = $timestamp; if (empty($options)) { $this->options = array(array('host' => '127.0.0.1', 'port' => 11211)); } else { $this->options = $options; } $this->memcache = new Memcache(); foreach ($this->options as $serverConfig) { $link_result = $this->memcache->addServer($serverConfig['host'], $serverConfig['port']); if ($link_result === false) { $this->log->error("{$serverConfig['host']} : {$serverConfig['port']} addServer Failed"); } } $this->conntected = true; register_shutdown_function(array($this, 'close')); }
public static function startSessionWithParams($sessionName = '', $sessionDomain = '', $sessionId = '', $sessionType = 'file', $options = array()) { // Zc::dump($sessionName); // Zc::dump($sessionDomain); // Zc::dump($sessionId); // Zc::dump($sessionType); // Zc::dump($options); self::$log = Zc::getLog('session/manager.log'); if (!empty($sessionName)) { session_name($sessionName); } session_set_cookie_params(0, '/', !empty($sessionDomain) ? $sessionDomain : ''); if (!empty($sessionId)) { session_id($sessionId); } if ($sessionType === 'memcached' || $sessionType == 'db') { $handlerClassName = 'Zc' . ucfirst($sessionType) . 'SessionHandler'; self::$sessionHander = new $handlerClassName($options); session_set_save_handler(array(self::$sessionHander, 'open'), array(self::$sessionHander, 'close'), array(self::$sessionHander, 'read'), array(self::$sessionHander, 'write'), array(self::$sessionHander, 'destroy'), array(self::$sessionHander, 'gc')); register_shutdown_function('session_write_close'); } elseif ($sessionType === 'file') { if (!empty($options['session_save_path'])) { session_save_path($options['session_save_path']); } } else { throw new Exception("do not support session type {$sessionType}"); } $ret = session_start(); if (!$ret) { self::$log->monitor("{$sessionType} session start failed"); } self::$isStart = $ret; if (!isset($_SESSION['securityToken'])) { $_SESSION['securityToken'] = md5(uniqid(rand(), true)); } }
public function __construct() { $this->lifeTime = $this->getLiftTime(); $this->sessionLog = Zc::getLog('session/handler.log', ZcLog::INFO, false); }
public function __construct($timestamp, $options = '') { $this->log = Zc::getLog('cache/debug_cache.log'); $this->timestamp = $timestamp; }