You are here

function performance_cron_prune in Performance Logging and Monitoring 6.2

Same name and namespace in other branches
  1. 7.2 performance.module \performance_cron_prune()

Callback used by performance_traverse_cache() for pruning data on cron based on a preset threshold.

Parameters

$cache cache object:

See also

performance_traverse_cache()

1 string reference to 'performance_cron_prune'
performance_cron in ./performance.module
Implementation of hook_cron().

File

./performance.module, line 114
Logs detailed and/or summary page generation time and memory consumption for page requests. Copyright Khalid Baheyeldin 2008 of http://2bits.com

Code

function performance_cron_prune($cache) {
  static $threshold;

  // Prevent a variable_get() each time this callback is triggered.
  if (!isset($threshold)) {
    $threshold = variable_get('performance_threshold_accesses', 0);
  }
  if ($threshold && $cache->data['num_accesses'] <= $threshold) {
    cache_clear_all($cache->cid, PERFORMANCE_BIN);
  }
  return;
}