You are here

public function Acquiadam::staticAssetCache in Media: Acquia DAM 8

Static asset cache helper.

This is a public standalone method to enable unit testing the behavior.

Parameters

string $op: The operation to perform. One of get, set, or clear.

int $assetId: The asset ID when using get or set.

\cweagans\webdam\Entity\Asset|false|null $asset: The data to store under the given asset ID.

Return value

mixed|null The static cache or NULL if unset.

1 call to Acquiadam::staticAssetCache()
Acquiadam::getAsset in src/Acquiadam.php

File

src/Acquiadam.php, line 160

Class

Acquiadam
Class Acquiadam.

Namespace

Drupal\media_acquiadam

Code

public function staticAssetCache($op, $assetId = NULL, $asset = NULL) {
  if ('set' == $op) {
    return static::$cachedAssets[$assetId] = $asset;
  }
  elseif ('clear' == $op) {
    static::$cachedAssets = [];
  }
  return static::$cachedAssets[$assetId] ?? NULL;
}