public function execute() { if ($this->_result === null) { if (modelCache::isEnabled()) { $this->_result = modelCache::getResult($this); } if ($this->_result) { return true; } else { $this->_result = $this->getStorage()->query($this->getSql()); if ($this->_result) { if (modelCache::isEnabled()) { // rebuild as array $results = array(); while ($result = $this->fetch()) { $results[] = $result; } modelCache::cache($this, $results); $this->_result = $results; $this->_finished = false; } else { //$this->_result = $results; } return true; } } return false; } return true; }
public static function getMemcache() { if (!self::$_memcacheEnabled) { return null; } if (self::$_memcache === null) { if (class_exists('Memcache')) { self::$_memcache = new Memcache(); if (self::$_memcache->connect('localhost', 11211)) { return self::$_memcache; } } self::$_memcache = false; } return self::$_memcache; }