LazyRecord\BaseModel::loadFromCache PHP Method

loadFromCache() public method

public loadFromCache ( $args, $ttl = 3600 )
    public function loadFromCache($args, $ttl = 3600)
    {
        $key = serialize($args);
        if ($cacheData = $this->getCache($key)) {
            $this->_data = $cacheData;
            $pk = static::PRIMARY_KEY;
            return $this->reportSuccess('Data loaded', array('id' => isset($this->_data[$pk]) ? $this->_data[$pk] : null));
        } else {
            $ret = $this->load($args);
            $this->setCache($key, $this->_data, $ttl);
            return $ret;
        }
    }