public static function Cache::buildTags

public static Cache::buildTags($prefix, array $suffixes, $glue = ':')

Build an array of cache tags from a given prefix and an array of suffixes.

Each suffix will be converted to a cache tag by appending it to the prefix, with a colon between them.

Parameters

string $prefix: A prefix string.

array $suffixes: An array of suffixes. Will be cast to strings.

string $glue: A string to be used as glue for concatenation. Defaults to a colon.

Return value

string[] An array of cache tags.

File

core/lib/Drupal/Core/Cache/Cache.php, line 130

Class

Cache
Helper methods for cache.

Namespace

Drupal\Core\Cache

Code

public static function buildTags($prefix, array $suffixes, $glue = ':') {
  $tags = [];
  foreach ($suffixes as $suffix) {
    $tags[] = $prefix . $glue . $suffix;
  }
  return $tags;
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Cache!Cache.php/function/Cache::buildTags/8.1.x