Returns a record (cached)
@return self
556027
public static function findRecord($key)
    {
        $record = new static;

        list($namespace, $group, $item) = $record->parseKey($key);

        return $record
            ->applyKey($key)
            ->remember(5, implode('-', [$record->getTable(), $namespace, $group, $item]))
            ->first();
    }
748906
protected function getRecords()
    {
        $records = null;
        $model = $this->controller->reorderGetModel();
        $query = $model->newQuery();

        $this->controller->reorderExtendQuery($query);

        if ($this->sortMode == 'simple') {
            $records = $query
                ->orderBy($model->getSortOrderColumn())
                ->get()
            ;
        }
        elseif ($this->sortMode == 'nested') {
            $records = $query->getNested();
        }

        return $records;
    }
1101276
public function getRecordIdent()
    {
        $ident = $this->getExternalID();
        if (empty($ident)) {
            $ident = $this->getRecordCode();
        }
        if (empty($ident)) {
            $ident = $this->getRecordID();
        }
        return $ident;
    }
581608
final public function to_record() {
        $data = new stdClass();
        $properties = static::properties_definition();
        foreach ($properties as $property => $definition) {
            $data->$property = $this->raw_get($property);
        }
        return $data;
    }
765664
private function saveObjectDataToCache()
    {
        Cacher::getInstance()->getDefaultCacher()->set($this->getCacheKey(), $this->getAsArray(), 3600);

        return $this;
    }
602696
private function getCached() {
        if (isset($_GET['noCache'])) return null;
        $cacheDir = DATA . 'select' . DIRECTORY_SEPARATOR;
        if (!is_dir($cacheDir)) mkdir($cacheDir, 0777, true);

        $cache = $cacheDir . base64_encode($this->getName()) . '.php';
        if (!is_readable($cache)) return null;
        $cached = include $cache;
        return $this->decode($cached[$this->encode($this->query . serialize($this->values))]);
    }
1130642
public static function getByID($id)
    {
        $record = static::getRecordByField(static::$primaryKey ? static::$primaryKey : 'ID', $id, true);

        return static::instantiateRecord($record);
    }
892277
private function getCache()
    {
        // cache for single run
        // so that getLastModified and getContent in single request do not add additional cache roundtrips (i.e memcache)
        if (isset($this->parsed)) {
            return $this->parsed;
        }

        // check from cache first
        $cache = null;
        $cacheId = $this->getCacheId();
        if ($this->cache->isValid($cacheId, 0)) {
            if ($cache = $this->cache->fetch($cacheId)) {
                $cache = unserialize($cache);
            }
        }

        $input = $cache ? $cache : $this->filepath;

        if ($this->cacheIsStale($cache)) {
            $cache = $this->compile($this->filepath);
        }

        if (!is_array($input) || $cache['updated'] > $input['updated']) {
            $this->cache->store($cacheId, serialize($cache));
        }

        return $this->parsed = $cache;
    }
1364307
public function getCacheInstance()
    {
        if (!$this->cacheInstance) {
            $factory             = $this->getCacheFactory();
            $this->cacheInstance = $factory->createService($this);
        }

        return $this->cacheInstance;
    }
1161137
public function cached()
    {
        $fileID = $this->getCacheID();
        $storage = Storage::disk($this->cache_disk);
        if ($storage->exists($this->generateCacheFilePath($fileID, true))) {
            return $this->makeImage(
                $this->storagePath(
                    $this->generateCacheFilePath($fileID, true)
                )
            );
        }
    }
201750
public function getRelated()
    {
        if ($this->instance instanceof RecordInterface) {
            return $this->instance;
        }

        if (!$this->isLoaded()) {
            //Lazy loading our relation data
            $this->loadData();
        }

        if (!empty($this->instance)) {
            return $this->instance;
        }

        if (!empty($this->data)) {
            $this->instance = $this->orm->make(
                $this->getClass(),
                $this->data,
                ORMInterface::STATE_LOADED,
                true
            );
        } elseif ($this->isPlaceholderNeeded()) {
            //Stub instance
            $this->instance = $this->orm->make(
                $this->getClass(),
                [],
                ORMInterface::STATE_NEW
            );
        }

        return $this->instance;
    }
1025813
public function getCache()
    {
        if (@file_exists($this->getCacheKey())) {
            ob_start();
            include $this->getCacheKey();
            $cache = ob_get_contents();
            ob_end_clean();
            return $cache;
        }
        return null;
    }
1009641
public function getCacheInstance()
    {
        if (null === $this->cacheInstance) {
            $this->cacheInstance = $this->cacheManager->getCache(self::CACHE_IDENTIFIER);
        }

        return $this->cacheInstance;
    }
117175
public function getCached()
    {
        return $this->app['cache']->remember($this->config('cache.key'), $this->config('cache.lifetime'), function () {
            return $this->toCollection()->toArray();
        });
    }
617479
public function clearCache()
    {
        if (!empty($this->schema))
        {
            $this->schema->clearCache();
        }

        $this->dao = [];
        $this->schema = null;
        return $this;
    }
1342656
public static function getInstance(){
		if(!is_object(self::$instance)){
			if(DEBUG_CACHE){
				BLog::addToLog('[BCache]: Creating cache object ('.CACHE_TYPE.')...');
				}
			switch(CACHE_TYPE){
				case 'files':
					self::$instance=new \Brilliant\Cache\BCacheFiles();
					break;
				case 'memcache':
					bimport('cache.memcache');
					self::$instance=new \Brilliant\Cache\BCacheMemcache();
					break;
				case 'memcached':
					bimport('cache.memcached');
					self::$instance=new \Brilliant\Cache\BCacheMemcached();
					break;
				default:
					self::$instance=NULL;
					break;
				}
			}
		return self::$instance;
		}
279188
public function getCache()
    {
        if (empty($this->cache)) {
            $this->cache = new HierarchicalSimpleCache($this->getMySQL(), basename(__FILE__, '.php'));
        }
        return $this->cache;
    }