Elgg\Database\EntityTable::getFromCache PHP Method

getFromCache() protected method

Get an entity from the in-memory or memcache caches
protected getFromCache ( integer $guid ) : ElggEntity
$guid integer GUID
return ElggEntity
    protected function getFromCache($guid)
    {
        $entity = $this->entity_cache->get($guid);
        if ($entity) {
            return $entity;
        }
        $memcache = _elgg_get_memcache('new_entity_cache');
        $entity = $memcache->load($guid);
        if (!$entity instanceof ElggEntity) {
            return false;
        }
        // Validate accessibility if from memcache
        if (!elgg_get_ignore_access() && !has_access_to_entity($entity)) {
            return false;
        }
        $this->entity_cache->set($entity);
        return $entity;
    }