public function myCache($namespace, $expiry = NULL) { $this->m_namespace = $namespace; if (self::$s_memcache == NULL) { if (!function_exists('memcache_connect')) { return; } self::$s_memcache = new Memcache(); //self::$s_memcache->pconnect(self::SERVER, self::PORT) // this will use a persistent connection try { $res = @self::$s_memcache->connect(kConf::get("memcache_host"), kConf::get("memcache_port")); } catch (Exception $e) { $res = false; } if (!$res) { kLog::log("ERROR: Error while trying to connect to memcache. Make sure it is properly running on " . kConf::get("memcache_host") . ":" . kConf::get("memcache_port")); //throw new Exception ("Error while trying to connect to memcache. Make sure it is properly running on " . self::SERVER . ":" . self::PORT ); } else { self::$s_ready = true; } // or die ("Error while trying to connect to memcache. Make sure it is properly running on " . self::SERVER . ":" . self::PORT ); } if ($expiry != null) { $this->m_expiry = $expiry; } if ($this->calculateStats()) { $this->m_stats = $this->getStatsObj(); if ($this->m_stats == NULL) { $this->m_stats = new cacheStats(); } } else { $this->m_stats = new cacheStats(); } }