Elgg\Cache\SystemCache::load PHP Метод

load() публичный Метод

Retrieve the contents of a system cache.
public load ( string $type ) : string
$type string The type of cache to load
Результат string
    function load($type)
    {
        if ($this->isEnabled()) {
            $cached_data = $this->cache->load($type);
            if ($cached_data) {
                return $cached_data;
            }
        }
        return null;
    }

Usage Example

Пример #1
0
 /**
  * Configure locations from the cache
  *
  * @param SystemCache $cache The system cache
  * @return bool
  * @access private
  */
 public function configureFromCache(SystemCache $cache)
 {
     $data = $cache->load('view_locations');
     if (!is_string($data)) {
         return false;
     }
     // format changed, check version
     $data = unserialize($data);
     if (empty($data['version']) || $data['version'] !== '2.0') {
         return false;
     }
     $this->locations = $data['locations'];
     $this->cache = $cache;
     return true;
 }