/** * {@inheritdoc} */ protected function doDelete(array $ids) { foreach ($ids as $id) { apcu_delete($id); } return true; }
/** * Delete a key from the cache pool * * @param $key * * @return bool */ public function deleteKey($key) { if (function_exists('apcu_delete')) { return apcu_delete($key); } return apc_delete($key); }
public function remove($key) { if ($this->apcu) { return apcu_delete((string) $key); } return apc_delete((string) $key); }
public function cleanup() { $regexp = self::CACHE_PREFIX . (empty($this->_config['store_prefix']) ? '' : $this->_config['store_prefix'] . ':'); $regexp = preg_quote($regexp, '/'); $to_be_deleted = new \APCuIterator("/^{$regexp}/", APC_ITER_VALUE); return apcu_delete($to_be_deleted); }
public function deleteMultiple(array $keys) { // The docs leave out the fact that apcu_delete() can take an array of keys, // when you provide an array of keys, it provides an array of errors (if any) // so the only successful case is no errors (empty array). $ret = apcu_delete($keys); return empty($ret); }
public function delete($name) { if ($this->hasAPCu) { apcu_delete($name); } else { unset($_SESSION[$name]); } }
/** * Delete a value from the cache * * @param string $key * @throws \Desarrolla2\Cache\Exception\ApcCacheException */ public function delete($key) { if ($this->has($key)) { $tKey = $this->getKey($key); if (!($this->apcu ? \apcu_delete($tKey) : \apc_delete($tKey))) { throw new ApcCacheException('Error deleting data with the key "' . $key . '" from the APC cache.'); } } }
public static function delete($k) { if (function_exists('apc_delete')) { return apc_delete($k); } elseif (function_exists('apcu_delete')) { return apcu_delete($k); } return false; }
public function remove($id) { $id = $this->_processId($id); $ret = true; if (php_sapi_name() == 'cli') { $ret = Kwf_Util_Apc::callClearCacheByCli(array('cacheIds' => $id)); } return $ret && apcu_delete($id); }
/** * {@inheritdoc} * * @return \Orno\Cache\Adapter\Apc */ public function delete($key) { if ($this->apcu) { apcu_delete($key); } else { apc_delete($key); } return $this; }
public function del($key) { if (is_array($key)) { foreach ($key as $k) { apcu_delete($k); } } else { apcu_delete($key); } }
/** * {@inheritdoc} */ protected function deleteArrayDataFromStorage(array $keys) { $deleted = true; foreach ($keys as $key) { if (apcu_delete($key) === false) { $deleted = false; } } return $deleted; }
/** * @inheritdoc */ public function del($key, $fields) { if (is_string($fields)) { return (int) apcu_delete($this->getKeyByField($key, $fields)); } $data = array_map(function ($field) use($key) { return (int) apcu_delete($this->getKeyByField($key, $field)); }, $fields); $result = array_count_values($data); return empty($result[1]) ? 0 : $result[1]; }
public function clear($prefix = '') { $ns = $this->getPrefix() . $prefix; $ns = preg_quote($ns, '/'); if (class_exists('\\APCIterator')) { $iter = new \APCIterator('user', '/^' . $ns . '/', APC_ITER_KEY); } else { $iter = new \APCUIterator('/^' . $ns . '/', APC_ITER_KEY); } return apcu_delete($iter); }
public function flush() { $this->_cache = array(); $iterator = class_exists('\\APCUIterator') ? new \APCUIterator() : new \APCIterator('user'); foreach ($iterator as $key => $value) { if ($this->_prefix === '' or strpos($key, $this->_prefix) === 0) { \apcu_delete($key); } } $iterator = null; return $this; }
public function delete($key) { if (!$this->active) { return false; } $cache_info = apc_cache_info('user'); $cache_list = $cache_info['cache_list']; foreach ($cache_list as $entry) { if (strpos($entry['info'], CACHE_PREFIX . $key) === 0) { apcu_delete($entry['info']); } } }
/** * {@inheritdoc} */ protected function doSave(array $values, $lifetime) { try { return array_keys(apcu_store($values, null, $lifetime)); } catch (\Error $e) { } catch (\Exception $e) { } if (1 === count($values)) { // Workaround https://github.com/krakjoe/apcu/issues/170 apcu_delete(key($values)); } throw $e; }
public function clear($id = null) { if ($id === null) { if (apcu_clear_cache()) { return true; } } else { if (apcu_delete($id)) { return true; } } return false; }
public function invalidate() { try { $key = $this->input->get('key', '', 'raw'); if (empty($key) || !apcu_exists($key)) { throw new \Exception('Invalid Key: ' . $key); } apcu_delete($key); \Dsc\System::addMessage('Invalidated ' . $key, 'success'); } catch (\Exception $e) { \Dsc\System::addMessage($e->getMessage(), 'error'); } $this->app->reroute('/admin/cache/apcu'); }
/** * @inheritdoc */ public function delete($key_or_keys) { if (!$this->is_enabled()) { return false; } $cache_keys = is_string($key_or_keys) ? [$key_or_keys] : $key_or_keys; foreach ($cache_keys as $key) { // http://php.net/manual/en/function.apcu-delete.php apcu_delete($key); // have to assume success because there doesn't seem to be a way to // determine if a delete failed or if the key was just missing } return true; }
/** * Removes entry from APC or flushes APC user entry storage * * @param mixed $keys Keys to clear, string or array */ protected function _clear(&$keys) { /* make an array if only one string is present, easier processing */ if (!is_array($keys)) { $keys = array($keys => true); } foreach ($keys as $key => $dummy) { if (!apcu_delete($key)) { $this->log(sprintf(__translate__('Failed to delete APC entry: %s', 'wp-ffpc'), $key), LOG_WARNING); //throw new Exception ( __translate__('Deleting APC entry failed with key ', 'wp-ffpc' ) . $key ); } else { $this->log(sprintf(__translate__('APC entry delete: %s', 'wp-ffpc'), $key)); } } }
/** * {@inheritdoc} */ function loadClass($class) { // Look if the cache has anything for this class. if ($file = \apcu_fetch($this->prefix . $class)) { if (is_file($file)) { require $file; return; } \apcu_delete($this->prefix . $class); } // Resolve cache miss. $api = new LoadClassGetFileInjectedApi($class); if ($this->finder->apiFindFile($api, $class)) { \apcu_store($this->prefix . $class, $api->getFile()); } }
public function testApcu() { $key = __CLASS__; apcu_delete($key); $this->assertFalse(apcu_exists($key)); $this->assertTrue(apcu_add($key, 123)); $this->assertTrue(apcu_exists($key)); $this->assertSame(array($key => -1), apcu_add(array($key => 123))); $this->assertSame(123, apcu_fetch($key)); $this->assertTrue(apcu_store($key, 124)); $this->assertSame(124, apcu_fetch($key)); $this->assertSame(125, apcu_inc($key)); $this->assertSame(124, apcu_dec($key)); $this->assertTrue(apcu_cas($key, 124, 123)); $this->assertFalse(apcu_cas($key, 124, 123)); $this->assertTrue(apcu_delete($key)); $this->assertFalse(apcu_delete($key)); $this->assertArrayHasKey('cache_list', apcu_cache_info()); }
/** * Unlock cached item * * @param string $id The cache data ID * @param string $group The cache data group * * @return boolean * * @since 3.5 */ public function unlock($id, $group = null) { $cache_id = $this->_getCacheId($id, $group) . '_lock'; // The apcu_delete function returns false if the ID does not exist if (apcu_exists($cache_id)) { return apcu_delete($cache_id); } return true; }
protected function clearOneObjectFromCache($key) { apcu_delete($key); return true; }
/** * Remove entry from memory * * @param string $key * * @return boolean */ public function delete($key) { return apcu_delete($this->getFinalKey($key)); }
public function rm($key) { $key = $this->prefix . $key; return $this->apcu ? apc_delete($key) : apcu_delete($key); }
\t\t\t\t<big>Wrong Username or Password!</big><br/> <br/> \t\t\t\t<big><a href='{$PHP_SELF}?OB={$MYREQUEST['OB']}'>Continue...</a></big> \t\t\t\t</body></html> EOB; exit; } else { $AUTHENTICATED = 1; } } } // clear cache if ($AUTHENTICATED && isset($MYREQUEST['CC']) && $MYREQUEST['CC']) { apcu_clear_cache(); } if ($AUTHENTICATED && !empty($MYREQUEST['DU'])) { apcu_delete($MYREQUEST['DU']); } if (!function_exists('apcu_cache_info')) { echo "No cache info available. APC does not appear to be running."; exit; } $cache = apcu_cache_info(); $mem = apcu_sma_info(); // don't cache this page // header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1 header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); // HTTP/1.0 function duration($ts)
/** * Deletes a value with the specified key from cache * This is the implementation of the method declared in the parent class. * @param string $key the key of the value to be deleted * @return boolean if no error happens during deletion */ protected function deleteValue($key) { return $this->useApcu ? apcu_delete($key) : apc_delete($key); }
/** * Internal method to remove multiple items. * * @param array $normalizedKeys * @return array Array of not removed keys * @throws Exception\ExceptionInterface */ protected function internalRemoveItems(array &$normalizedKeys) { $options = $this->getOptions(); $namespace = $options->getNamespace(); if ($namespace === '') { return apcu_delete($normalizedKeys); } $prefix = $namespace . $options->getNamespaceSeparator(); $internalKeys = []; foreach ($normalizedKeys as $normalizedKey) { $internalKeys[] = $prefix . $normalizedKey; } $failedKeys = apcu_delete($internalKeys); // remove prefix $prefixL = strlen($prefix); foreach ($failedKeys as &$key) { $key = substr($key, $prefixL); } return $failedKeys; }