Skip to content
Snippets Groups Projects
Verified Commit d16a7a5a authored by Alberto Paderno's avatar Alberto Paderno
Browse files

Issue #3463810: Include DrupalApcCache::deleteKeys() and...

Issue #3463810: Include DrupalApcCache::deleteKeys() and DrupalApcCache::deleteKey() to the logged operations
parent 3b0019ea
No related branches found
No related tags found
1 merge request!30Issue #3463810: Include DrupalApcCache::deleteKeys() and DrupalApcCache::deleteKey() to the logged operations
Pipeline #233996 passed
......@@ -280,6 +280,7 @@ public function set($cid, $data, $expire = CACHE_PERMANENT) {
*/
protected function deleteKey($cid) {
if (apcu_enabled()) {
$this->operations(array('deleteKey()', $this->bin, $cid));
apcu_delete($this->keyName($cid));
}
}
......@@ -292,6 +293,8 @@ protected function deleteKey($cid) {
*/
protected function deleteKeys($prefix = NULL) {
if (apcu_enabled() && class_exists('APCUIterator')) {
$this->operations(array('deleteKeys()', $this->bin, $prefix));
$escaped_key = preg_quote($this->keyName($prefix), '/');
$iterator = new APCUIterator("/^$escaped_key/", APC_ITER_KEY);
apcu_delete($iterator);
......@@ -310,9 +313,6 @@ public function clear($cid = NULL, $wildcard = FALSE) {
return;
}
// Add a get to our statistics.
$this->operations(array('clear()', $this->bin, $cid, (int) $wildcard));
if (empty($cid)) {
$this->deleteKeys();
}
......@@ -373,7 +373,7 @@ public static function pendingRequests() {
* The list of cache operations.
*/
public static function operations($new_operation = NULL) {
if (!is_null($new_operation)) {
if (!is_null($new_operation) && is_array($new_operation)) {
self::$operations[] = $new_operation;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment