function PerformanceTestTrait::isDatabaseCache

Same name in other branches
  1. 11.x core/tests/Drupal/Tests/PerformanceTestTrait.php \Drupal\Tests\PerformanceTestTrait::isDatabaseCache()

Checks whether a database event is from the database cache implementation.

Parameters

Drupal\Core\Database\Event\DatabaseEvent $event: The database event.

Return value

bool Whether the event was triggered by the database cache implementation.

2 calls to PerformanceTestTrait::isDatabaseCache()
PerformanceTestTrait::collectPerformanceData in core/tests/Drupal/Tests/PerformanceTestTrait.php
Executes a callable and collects performance data.
PerformanceTestTrait::openTelemetryTracing in core/tests/Drupal/Tests/PerformanceTestTrait.php
Sends metrics to OpenTelemetry.

File

core/tests/Drupal/Tests/PerformanceTestTrait.php, line 616

Class

PerformanceTestTrait
Provides various methods to aid in collecting performance data during tests.

Namespace

Drupal\Tests

Code

protected static function isDatabaseCache(DatabaseEvent $event) : bool {
    $class = str_replace('\\\\', '\\', $event->caller['class']);
    return is_a($class, '\\Drupal\\Core\\Cache\\DatabaseBackend', TRUE) || is_a($class, '\\Drupal\\Core\\Cache\\DatabaseCacheTagsChecksum', TRUE);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.