Permalink
Browse files

MDL-38165 cache: fixed up session event purging

  • Loading branch information...
Sam Hemelryk
Sam Hemelryk committed Feb 27, 2013
1 parent cce0d9a commit b6c86be1971549baafcb83ae71de7d230d1ad666
Showing with 10 additions and 2 deletions.
  1. +10 −2 cache/classes/loaders.php
View
@@ -1435,6 +1435,7 @@ 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) {
@@ -1446,11 +1447,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);
}

0 comments on commit b6c86be

Please sign in to comment.