コード例 #1
0
 function __construct($name, $cfg, $lazy = false)
 {
     parent::__construct($name, $cfg, $lazy);
     // default if not set
     $timeout = $this->cfg["timeout"] > 0 ? $this->cfg["timeout"] : 0;
     $persist = $this->cfg["persist"] ? true : false;
     $this->cache = new Memcache();
     // add to the list
     $servers = any($this->cfg["servers"], $this->cfg["host"]);
     if (!empty($servers)) {
         // If it's a string, assume it's space-separated
         if (is_string($servers)) {
             $servers = explode(" ", $servers);
         }
         foreach ($servers as $server) {
             list($host, $port) = explode(":", $server);
             if (empty($port)) {
                 $port = 11211;
             }
             // default memcache port
             //Profiler::StartTimer("MemcacheCache::addServers()");
             $this->servers[$host] = $params = array("port" => $port, "timeout" => $timeout, "persist" => $persist);
             //Logger::Info("Added memcache server - %s:%s (persist=%d)", $host, $params["port"], $params["persist"]);
             $this->cache->addServer($host, $params["port"], $params["persist"]);
             //Profiler::StopTimer("MemcacheCache::addServers()");
         }
     }
 }
コード例 #2
0
 public function __construct($name, $cfg, $lazy = false, $twitterConfig = array())
 {
     parent::__construct($name, $cfg, $lazy);
     $this->authprovider = UserAuthProvider::get("twitter");
     $this->authprovider->build($twitterConfig);
     $this->twitter =& $this->authprovider->twitter;
 }