/** * {@inheritdoc} */ public function deleteMulti(array $keys, $cache_bin = '') { // No point in performing any action is we're not connected to memcached. if (empty($this->isConnected)) { return; } // Format every cache key before the request to memcached pool. $memcached_keys = []; foreach ($keys as $key) { $memcached_key = $this->itemKey($key, $cache_bin); $memcached_keys[$memcached_key] = $key; } // Perform preparations for the debug logging. if (!empty($this->debug)) { DrupalMemcachedDebug::prepare(); } // Make a request to delete all cache items. $result = $this->memcached->deleteMulti(array_keys($memcached_keys)); // Logs the debug entry about the memcached operation. if (!empty($this->debug)) { DrupalMemcachedDebug::process('delete', $result, $memcached_keys, $cache_bin, $this->cluster); } }
/** * {@inheritdoc} */ public function deleteMulti(array $keys, $cache_bin = '') { // No point in performing any action is we're not connected to memcached. if (empty($this->isConnected)) { return; } // PECL memcache doesn't support multiple deletion of elements, so // loop through all elements and delete one by one. foreach ($keys as $key) { $memcached_key = $this->itemKey($key, $cache_bin); // Perform preparations for the debug logging. if (!empty($this->debug)) { DrupalMemcachedDebug::prepare(); } $result = $this->memcached->delete($memcached_key); // Logs the debug entry about the memcached operation. if (!empty($this->debug)) { $memcached_keys = [$memcached_key => $key]; DrupalMemcachedDebug::process('delete', $result, $memcached_keys, $cache_bin, $this->cluster); } } }