src/Charcoal/Model/Service/MetadataLoader.php
private function loadMetadataFromCache($ident, array $idents = null)
    {
        $cacheKey  = $this->cacheKeyFromMetaKey($ident);
        $cacheItem = $this->cachePool()->getItem($cacheKey);

        if ($cacheItem->isHit()) {
            $metadata = $cacheItem->get();

            /** Backwards compatibility */
            if ($metadata instanceof MetadataInterface) {
                $metadata = $metadata->data();
                $cacheItem->set($metadata);
                $this->cachePool()->save($cacheItem);
            }

            return $metadata;
        } else {
            if (empty($idents)) {
                $metadata = $this->loadMetadataByKey($ident);
            } else {
                $metadata = $this->loadMetadataByKeys($idents);
            }

            $cacheItem->set($metadata);
            $this->cachePool()->save($cacheItem);
        }

        return $metadata;
    }
private function loadMetadataFromCache($ident, array $idents = null)
    {
        $cacheKey  = $this->cacheKeyFromMetaKey($ident);
        $cacheItem = $this->cachePool()->getItem($cacheKey);

        if ($cacheItem->isHit()) {
            $metadata = $cacheItem->get();

            /** Backwards compatibility */
            if ($metadata instanceof MetadataInterface) {
                $metadata = $metadata->data();
                $cacheItem->set($metadata);
                $this->cachePool()->save($cacheItem);
            }

            return $metadata;
        } else {
            if (empty($idents)) {
                $metadata = $this->loadMetadataByKey($ident);
            } else {
                $metadata = $this->loadMetadataByKeys($idents);
            }

            $cacheItem->set($metadata);
            $this->cachePool()->save($cacheItem);
        }

        return $metadata;
    }
private function loadMetadataFromCache ( $ ident , array $ idents = null ) { $ cacheKey = $ this -> cacheKeyFromMetaKey ( $ ident ) ; $ cacheItem = $ this -> cachePool ( ) -> getItem ( $ cacheKey ) ; if ( $ cacheItem -> isHit ( ) ) { $ metadata = $ cacheItem -> get ( ) ; /** Backwards compatibility */ if ( $ metadata instanceof MetadataInterface ) { $ metadata = $ metadata -> data ( ) ; $ cacheItem -> set ( $ metadata ) ; $ this -> cachePool ( ) -> save ( $ cacheItem ) ; } return $ metadata ; } else { if ( empty ( $ idents ) ) { $ metadata = $ this -> loadMetadataByKey ( $ ident ) ; } else { $ metadata = $ this -> loadMetadataByKeys ( $ idents ) ; } $ cacheItem -> set ( $ metadata ) ; $ this -> cachePool ( ) -> save ( $ cacheItem ) ; } return $ metadata ; }
Load a metadataset from the cache.

@param  string $ident  The metadata identifier to load / cache key for $idents.
@param  array  $idents If provided, $ident is used as the cache key
and these metadata identifiers are loaded instead.
@return array The data associated with the metadata identifier.
Load a metadataset from the cache .