You are here

class CacheItem in Flysystem 8

Same name and namespace in other branches
  1. 3.x src/Flysystem/Adapter/CacheItem.php \Drupal\flysystem\Flysystem\Adapter\CacheItem
  2. 2.0.x src/Flysystem/Adapter/CacheItem.php \Drupal\flysystem\Flysystem\Adapter\CacheItem
  3. 3.0.x src/Flysystem/Adapter/CacheItem.php \Drupal\flysystem\Flysystem\Adapter\CacheItem

A filesystem item stored in the Drupal cache.

Hierarchy

  • class \Drupal\flysystem\Flysystem\Adapter\CacheItem

Expanded class hierarchy of CacheItem

2 files declare their use of CacheItem
CacheItemBackendTest.php in tests/src/Unit/Flysystem/Adapter/CacheItemBackendTest.php
CacheItemTest.php in tests/src/Unit/Flysystem/Adapter/CacheItemTest.php

File

src/Flysystem/Adapter/CacheItem.php, line 8

Namespace

Drupal\flysystem\Flysystem\Adapter
View source
class CacheItem {

  /**
   * The array of metadata for the item.
   *
   * @var array
   */
  protected $metadata = [];

  /**
   * Returns the metadata for the item.
   *
   * @return array
   *   The array of metadata for the item.
   */
  public function getMetadata() {
    return $this->metadata;
  }

  /**
   * Updates the metadata for the item.
   *
   * @param array $metadata
   *   The array of metadata for the item.
   */
  public function updateMetadata(array $metadata) {
    static $keys = [
      'size' => TRUE,
      'mimetype' => TRUE,
      'visibility' => TRUE,
      'timestamp' => TRUE,
      'type' => TRUE,
    ];
    $this->metadata = array_intersect_key($metadata, $keys) + $this->metadata;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
CacheItem::$metadata protected property The array of metadata for the item.
CacheItem::getMetadata public function Returns the metadata for the item.
CacheItem::updateMetadata public function Updates the metadata for the item.