Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MDL-38165 cache: fixed up application event purging

  • Loading branch information...
commit f9bbcc5302c438cc1ec01b9f42bf227d30434c4a 1 parent f810487
@samhemelryk samhemelryk authored
Showing with 11 additions and 3 deletions.
  1. +11 −3 cache/classes/loaders.php
View
14 cache/classes/loaders.php
@@ -1094,10 +1094,11 @@ public function __construct(cache_definition $definition, cache_store $store, $l
$cache = cache::make('core', 'eventinvalidation');
$events = $cache->get_many($definition->get_invalidation_events());
$todelete = array();
+ $purgeall = false;
// Iterate the returned data for the events.
foreach ($events as $event => $keys) {
if ($keys === false) {
- // There are no keys.
+ // No data to be invalidated yet.
continue;
}
// Look at each key and check the timestamp.
@@ -1105,11 +1106,18 @@ public function __construct(cache_definition $definition, cache_store $store, $l
// If the timestamp of the event is more than or equal to the last invalidation (happened between the last
// invalidation and now)then we need to invaliate the key.
if ($timestamp >= $lastinvalidation) {
- $todelete[] = $key;
+ if ($key === 'purged') {
+ $purgeall = true;
+ break;
+ } else {
+ $todelete[] = $key;
+ }
}
}
}
- if (!empty($todelete)) {
+ if ($purgeall) {
+ $this->purge();
+ } else if (!empty($todelete)) {
$todelete = array_unique($todelete);
$this->delete_many($todelete);
}
Please sign in to comment.
Something went wrong with that request. Please try again.