You are here

function performance_cron_apc_prune in Performance Logging and Monitoring 5

1 call to performance_cron_apc_prune()
performance_cron in ./performance.module

File

./performance.module, line 497

Code

function performance_cron_apc_prune() {

  // Remove entries from apc cache that has less than so many accesses
  // to prevent clutter
  $threshold = variable_get('performance_threshold_accesses', 0);
  if (!$threshold) {

    // Threshold not set
    return;
  }
  $list = performance_apc_list_all();
  if (!count($list)) {

    // Nothing stored yet
    return;
  }
  foreach ($list as $key) {
    if ($data = apc_fetch($key)) {
      if ($data['num_accesses'] <= $threshold) {
        apc_delete($key);
      }
    }
  }
}