You are here

public static function RateLimitManager::deleteExpired in RESTful 7.2

Delete all expired rate limit entities.

Overrides RateLimitManagerInterface::deleteExpired

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

File

src/RateLimit/RateLimitManager.php, line 174
Contains \Drupal\restful\RateLimit\RateLimitManager

Class

RateLimitManager

Namespace

Drupal\restful\RateLimit

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);
  }
}