You are here

public static function RestfulRateLimitManager::deleteExpired in RESTful 7

Delete all expired rate limit entities.

1 call to RestfulRateLimitManager::deleteExpired()
restful_cron in ./restful.module
Implements hook_cron().

File

plugins/rate_limit/RestfulRateLimitManager.php, line 154

Class

RestfulRateLimitManager
Contains RestfulRateLimitManager

Code

public static function deleteExpired() {

  // Clear the expired restful_rate_limit entries.
  $query = new \EntityFieldQuery();
  $results = $query
    ->entityCondition('entity_type', 'rate_limit')
    ->propertyCondition('expiration', REQUEST_TIME, '>')
    ->execute();
  if (!empty($results['rate_limit'])) {
    $rlids = array_keys($results['rate_limit']);
    entity_delete_multiple('rate_limit', $rlids);
  }
}