MDL-39459 cache: mode included in stats output
The cache store mode is now included in the performance stats printed at the bottom of the page. It is represented as either [a] [s] or [r] and a title is used to actually state the mode.
This commit is contained in:
committed by
Sam Hemelryk
parent
4c27f52d91
commit
7fa57e0341
Vendored
+14
-14
@@ -317,7 +317,7 @@ class cache implements cache_loader {
|
||||
$setaftervalidation = false;
|
||||
if ($result === false) {
|
||||
if ($this->perfdebug) {
|
||||
cache_helper::record_cache_miss($this->storetype, $this->definition->get_id());
|
||||
cache_helper::record_cache_miss($this->storetype, $this->definition);
|
||||
}
|
||||
if ($this->loader !== false) {
|
||||
// We must pass the original (unparsed) key to the next loader in the chain.
|
||||
@@ -329,7 +329,7 @@ class cache implements cache_loader {
|
||||
}
|
||||
$setaftervalidation = ($result !== false);
|
||||
} else if ($this->perfdebug) {
|
||||
cache_helper::record_cache_hit($this->storetype, $this->definition->get_id());
|
||||
cache_helper::record_cache_hit($this->storetype, $this->definition);
|
||||
}
|
||||
// 5. Validate strictness.
|
||||
if ($strictness === MUST_EXIST && $result === false) {
|
||||
@@ -473,8 +473,8 @@ class cache implements cache_loader {
|
||||
$hits++;
|
||||
}
|
||||
}
|
||||
cache_helper::record_cache_hit($this->storetype, $this->definition->get_id(), $hits);
|
||||
cache_helper::record_cache_miss($this->storetype, $this->definition->get_id(), $misses);
|
||||
cache_helper::record_cache_hit($this->storetype, $this->definition, $hits);
|
||||
cache_helper::record_cache_miss($this->storetype, $this->definition, $misses);
|
||||
}
|
||||
|
||||
// Return the result. Phew!
|
||||
@@ -500,7 +500,7 @@ class cache implements cache_loader {
|
||||
*/
|
||||
public function set($key, $data) {
|
||||
if ($this->perfdebug) {
|
||||
cache_helper::record_cache_set($this->storetype, $this->definition->get_id());
|
||||
cache_helper::record_cache_set($this->storetype, $this->definition);
|
||||
}
|
||||
if ($this->loader !== false) {
|
||||
// We have a loader available set it there as well.
|
||||
@@ -649,7 +649,7 @@ class cache implements cache_loader {
|
||||
}
|
||||
$successfullyset = $this->store->set_many($data);
|
||||
if ($this->perfdebug && $successfullyset) {
|
||||
cache_helper::record_cache_set($this->storetype, $this->definition->get_id(), $successfullyset);
|
||||
cache_helper::record_cache_set($this->storetype, $this->definition, $successfullyset);
|
||||
}
|
||||
return $successfullyset;
|
||||
}
|
||||
@@ -1039,7 +1039,7 @@ class cache implements cache_loader {
|
||||
}
|
||||
if ($result) {
|
||||
if ($this->perfdebug) {
|
||||
cache_helper::record_cache_hit('** static acceleration **', $this->definition->get_id());
|
||||
cache_helper::record_cache_hit('** static acceleration **', $this->definition);
|
||||
}
|
||||
if ($this->staticaccelerationsize > 1 && $this->staticaccelerationcount > 1) {
|
||||
// Check to see if this is the last item on the static acceleration keys array.
|
||||
@@ -1053,7 +1053,7 @@ class cache implements cache_loader {
|
||||
return $result;
|
||||
} else {
|
||||
if ($this->perfdebug) {
|
||||
cache_helper::record_cache_miss('** static acceleration **', $this->definition->get_id());
|
||||
cache_helper::record_cache_miss('** static acceleration **', $this->definition);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -1779,7 +1779,7 @@ class cache_session extends cache {
|
||||
// 4. Load if from the loader/datasource if we don't already have it.
|
||||
if ($result === false) {
|
||||
if ($this->perfdebug) {
|
||||
cache_helper::record_cache_miss($this->storetype, $this->get_definition()->get_id());
|
||||
cache_helper::record_cache_miss($this->storetype, $this->get_definition());
|
||||
}
|
||||
if ($this->get_loader() !== false) {
|
||||
// We must pass the original (unparsed) key to the next loader in the chain.
|
||||
@@ -1794,7 +1794,7 @@ class cache_session extends cache {
|
||||
$this->set($key, $result);
|
||||
}
|
||||
} else if ($this->perfdebug) {
|
||||
cache_helper::record_cache_hit($this->storetype, $this->get_definition()->get_id());
|
||||
cache_helper::record_cache_hit($this->storetype, $this->get_definition());
|
||||
}
|
||||
// 5. Validate strictness.
|
||||
if ($strictness === MUST_EXIST && $result === false) {
|
||||
@@ -1838,7 +1838,7 @@ class cache_session extends cache {
|
||||
$loader->set($key, $data);
|
||||
}
|
||||
if ($this->perfdebug) {
|
||||
cache_helper::record_cache_set($this->storetype, $this->get_definition()->get_id());
|
||||
cache_helper::record_cache_set($this->storetype, $this->get_definition());
|
||||
}
|
||||
if (is_object($data) && $data instanceof cacheable_object) {
|
||||
$data = new cache_cached_object($data);
|
||||
@@ -1962,8 +1962,8 @@ class cache_session extends cache {
|
||||
$hits++;
|
||||
}
|
||||
}
|
||||
cache_helper::record_cache_hit($this->storetype, $this->get_definition()->get_id(), $hits);
|
||||
cache_helper::record_cache_miss($this->storetype, $this->get_definition()->get_id(), $misses);
|
||||
cache_helper::record_cache_hit($this->storetype, $this->get_definition(), $hits);
|
||||
cache_helper::record_cache_miss($this->storetype, $this->get_definition(), $misses);
|
||||
}
|
||||
return $return;
|
||||
|
||||
@@ -2040,7 +2040,7 @@ class cache_session extends cache {
|
||||
}
|
||||
$successfullyset = $this->get_store()->set_many($data);
|
||||
if ($this->perfdebug && $successfullyset) {
|
||||
cache_helper::record_cache_set($this->storetype, $definitionid, $successfullyset);
|
||||
cache_helper::record_cache_set($this->storetype, $this->get_definition(), $successfullyset);
|
||||
}
|
||||
return $successfullyset;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user