You are here

protected function EntityCache::prepareCacheItem in Apigee Edge 8

Generates cache items for an entity.

The cache id returned here must be always unique!

Parameters

\Apigee\Edge\Entity\EntityInterface $entity: The entity object that gets cached.

Return value

array Array of cache items. An array that CacheBackendInterface::setMultiple() can accept.

See also

\Drupal\Core\Cache\CacheBackendInterface::setMultiple()

2 calls to EntityCache::prepareCacheItem()
DeveloperCache::prepareCacheItem in src/Entity/Controller/Cache/DeveloperCache.php
Generates cache items for an entity.
EntityCache::saveEntities in src/Entity/Controller/Cache/EntityCache.php
Saves entities to the cache.
2 methods override EntityCache::prepareCacheItem()
AppCache::prepareCacheItem in src/Entity/Controller/Cache/AppCache.php
Generates cache items for an entity.
DeveloperCache::prepareCacheItem in src/Entity/Controller/Cache/DeveloperCache.php
Generates cache items for an entity.

File

src/Entity/Controller/Cache/EntityCache.php, line 185

Class

EntityCache
Default entity cache implementation for controllers.

Namespace

Drupal\apigee_edge\Entity\Controller\Cache

Code

protected function prepareCacheItem(EntityInterface $entity) : array {
  return [
    $entity
      ->id() => [
      'data' => $entity,
      'tags' => [
        $entity
          ->id(),
      ],
    ],
  ];
}