You are here

public static function DrupalMemcachedDebug::getDetailedLogTable in Memcache Storage 8

Returns table element with detailed debug information about all memcached transactions.

Return value

array|bool

1 call to DrupalMemcachedDebug::getDetailedLogTable()
memcache_storage_page_bottom in ./memcache_storage.module
Implements hook_page_bottom().

File

src/DrupalMemcachedDebug.php, line 88

Class

DrupalMemcachedDebug
Class DrupalMemcachedDebug @package Drupal\memcache_storage

Namespace

Drupal\memcache_storage

Code

public static function getDetailedLogTable() {
  if (empty(self::$log)) {
    return FALSE;
  }
  $rows = [];
  foreach (self::$log as $entry) {
    $entry['result'] = !empty($entry['result']) ? 'HIT' : 'MISS';
    $class = strtolower($entry['result']);
    $rows[] = [
      'data' => $entry,
      'class' => [
        $class,
      ],
    ];
  }
  return [
    '#type' => 'table',
    '#header' => [
      t('Operation'),
      t('Time, ms'),
      t('Result'),
      t('Cache bin'),
      t('Cache key'),
      t('Memcached key'),
      t('Memcached cluster'),
    ],
    '#rows' => $rows,
    '#attributes' => [
      'id' => 'memcache-storage-detailed-debug',
    ],
    '#attached' => [
      'library' => [
        'memcache_storage/debug-table',
      ],
    ],
  ];
}