You are here

function drush_memcache_stats in Memcache API and Integration 7

Display memcache statistics.

Parameters

string $bin: The bin to retrieve statistics for.

string $stats_type: The type of statistics to retrieve when using the Memcache extension.

File

./memcache.drush.inc, line 55
Provides a drush interface to Memcached.

Code

function drush_memcache_stats($bin = 'cache', $stats_type = 'default') {
  if (_memcache_is_available()) {
    $interactive = drush_get_option('interactive', 0);
    $aggregate = drush_get_option('aggregate', 0);
    if ($interactive) {
      $options = array(
        'default' => 'default',
        'reset' => 'reset',
        'malloc' => 'malloc',
        'slabs' => 'slabs',
        'cachedump' => 'cachedump',
        'items' => 'items',
        'sizes' => 'sizes',
      );
      $stats_type = drush_choice($options, dt('What type of statistics would you like to see?'));

      // stats_type of FALSE === Cancel
      if ($stats_type === FALSE) {
        return;
      }
    }
    $stats = dmemcache_stats($bin, $stats_type, $aggregate);
    drush_print_r($stats);
  }
}