public static function Cache::validateTags in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/lib/Drupal/Core/Cache/Cache.php \Drupal\Core\Cache\Cache::validateTags()
Validates an array of cache tags.
Can be called before using cache tags in operations, to ensure validity.
Parameters
string[] $tags: An array of cache tags.
Throws
\LogicException
Deprecated
Use assert('\Drupal\Component\Assertion\Inspector::assertAllStrings($tags)');
2 calls to Cache::validateTags()
- CacheTest::testValidateTags in core/
tests/ Drupal/ Tests/ Core/ Cache/ CacheTest.php - @covers ::validateTags
- MemcacheBackend::set in modules/
memcache/ src/ MemcacheBackend.php - Stores data in the persistent cache.
File
- core/
lib/ Drupal/ Core/ Cache/ Cache.php, line 108 - Contains \Drupal\Core\Cache\Cache.
Class
- Cache
- Helper methods for cache.
Namespace
Drupal\Core\CacheCode
public static function validateTags(array $tags) {
if (empty($tags)) {
return;
}
foreach ($tags as $value) {
if (!is_string($value)) {
throw new \LogicException('Cache tags must be strings, ' . gettype($value) . ' given.');
}
}
}