delete() public méthode

public delete ( $id )
 /**
  * Clears the cache
  */
 public function clearCache()
 {
     if ($this->cache) {
         $this->cache->delete(self::CACHE_KEY);
     }
     $this->localCache = null;
 }
Exemple #2
0
 /**
  * @param $nombre
  */
 public function delete($nombre)
 {
     $list = $this->get($this->list_name);
     if (($key = array_search($nombre, $list)) !== false) {
         unset($list[$key]);
         $this->setList($list);
     }
     $this->cache->delete($nombre);
 }
 /**
  * {@inheritdoc}
  */
 public function deleteItems(array $keys)
 {
     foreach ($keys as $key) {
         if (true === $this->provider->contains($key)) {
             $this->provider->delete($key);
         }
     }
     return $this;
 }
Exemple #4
0
 /**
  * {@inheritdoc}
  */
 public function get(RequesterInterface $requester, ResourceInterface $resource)
 {
     $cacheId = $this->getCacheId($requester, $resource);
     $permission = $this->cacheProvider->fetch($cacheId);
     if ($permission instanceof PermissionInterface) {
         return $permission;
     }
     $this->cacheProvider->delete($cacheId);
     return;
 }
 public function checkDeploy(GetResponseEvent $event)
 {
     if (null === $this->cache || $this->cache->contains(self::CHECK_DEPLOY_KEY)) {
         return;
     }
     $clients = $this->clientRepository->countClients();
     $cities = $this->cityRepository->countCities();
     $hasDefaultClient = $this->clientRepository->findOneByUid($this->defaultClientUid) instanceof Client;
     if ($clients <= 0 || $cities <= 0 || !$hasDefaultClient) {
         $this->cache->delete(self::CHECK_DEPLOY_KEY);
         throw new \RuntimeException('Make sure you did run the populate database command.');
     } else {
         $this->cache->save(self::CHECK_DEPLOY_KEY, true);
     }
 }
Exemple #6
0
 /**
  * Removes an ACL from the cache
  *
  * @param string $key
  */
 private function evictFromCacheByKey($key)
 {
     if (!$this->cache->contains($key)) {
         return;
     }
     $this->cache->delete($key);
 }
 /**
  * @param string $key
  * @return bool
  */
 private function clearCache($key)
 {
     if (null === $this->cache) {
         return true;
     }
     return $this->cache->delete($key);
 }
Exemple #8
0
 /**
  * Deletes an item in the cache based on the id
  *
  * @param string $id    the id of the cached data entry
  * @return bool         true if the item was deleted successfully
  */
 public function delete($id)
 {
     if ($this->enabled) {
         return $this->driver->delete($id);
     }
     return false;
 }
 /**
  * @param $name
  */
 public function flushByName($name)
 {
     $keys = (array) $this->cache->fetch($name);
     foreach (array_keys($keys) as $key) {
         $this->cache->delete($key);
     }
     $this->cache->save($name, array());
 }
 /**
  * Removes multiple items from Cache.
  *
  * @param string[] $keys of items to be removed
  *
  * @return bool true on success.
  */
 public function deleteMulti(array $keys)
 {
     foreach ($keys as $key) {
         if (!$this->cache->delete($key)) {
             return false;
         }
     }
     return true;
 }
 /**
  * Clears the ownership metadata cache
  *
  * If the class name is not specified this method clears all cached data
  *
  * @param string|null $className
  */
 public function clearCache($className = null)
 {
     if ($this->cache) {
         if ($className !== null) {
             $this->cache->delete($className);
         } else {
             $this->cache->deleteAll();
         }
     }
 }
Exemple #12
0
 /**
  * Fetches an entry from the cache.
  *
  * @param string $id           The id of the cache entry to fetch
  * @param mixed  $defaultValue The default value if $id not found
  * @param bool   $remove
  *
  * @return mixed The cached data or FALSE, if no cache entry exists for the given id.
  */
 public function get($id, $defaultValue = null, $remove = false)
 {
     if (false === ($_data = $this->_store->fetch($id))) {
         if (!$remove) {
             $this->_store->save($id, $_data = $defaultValue);
         }
     } elseif ($remove) {
         $this->_store->delete($id);
     }
     return $_data;
 }
 /**
  * Clears the cache by security type
  *
  * If the $securityType is not specified, clear all cached data
  *
  * @param string|null $securityType The security type.
  */
 public function clearCache($securityType = null)
 {
     if ($this->cache) {
         if ($securityType !== null) {
             $this->cache->delete($securityType);
         } else {
             $this->cache->deleteAll();
         }
     }
     if ($securityType !== null) {
         unset($this->localCache[$securityType]);
     } else {
         $this->localCache = array();
     }
 }
 /**
  * Clear the environments cache for a project.
  *
  * Use this after creating/deleting/updating environment(s).
  *
  * @param Project $project
  */
 protected function clearEnvironmentsCache(Project $project = null)
 {
     $project = $project ?: $this->getSelectedProject();
     self::$cache->delete('environments:' . $project->id);
 }
Exemple #15
0
 public function delete($id)
 {
     return $this->_cacheImplement->delete($id);
 }
Exemple #16
0
 /**
  * Clear the projects cache.
  */
 public function clearProjectsCache()
 {
     self::$cache->delete(sprintf('%s:projects', self::$sessionId));
     self::$cache->delete(sprintf('%s:my-account', self::$sessionId));
 }
Exemple #17
0
 /**
  * {@inheritdoc}
  */
 public function delete($key)
 {
     return $this->cache->delete($key);
 }
 /**
  * @param ConfigIdInterface $configId
  * @return bool
  */
 public function removeConfigFromCache(ConfigIdInterface $configId)
 {
     return $this->cache->delete($configId->toString());
 }
Exemple #19
0
 /**
  * @param string $cacheKey
  * @param bool   $localCacheOnly
  *
  * @return bool
  */
 protected function deleteList($cacheKey, $localCacheOnly)
 {
     unset($this->localCache[$cacheKey]);
     return $localCacheOnly ? true : $this->cache->delete($cacheKey);
 }
Exemple #20
0
 /**
  * saves our addition array to our cache and removes the full map from the cache
  * leading to a regeneration of the map.
  *
  * @return void
  */
 private function persistAdditions()
 {
     $this->cache->save($this->cacheKey, $this->addedResources);
     // remove full map from cache
     $this->cache->delete($this->cacheKeyFinalResource);
 }
Exemple #21
0
 /**
  * @param string $className
  * @param string $fieldName
  * @param bool   $localCacheOnly
  *
  * @return bool
  */
 public function deleteFieldConfig($className, $fieldName, $localCacheOnly = false)
 {
     $cacheKey = $className . '.' . $fieldName;
     unset($this->localCache[$cacheKey]);
     return $localCacheOnly ? true : $this->cache->delete($cacheKey);
 }
Exemple #22
0
 /**
  * @param ConfigIdInterface $configId
  * @return bool
  */
 public function removeConfigFromCache(ConfigIdInterface $configId)
 {
     return $this->cache->delete($this->buildConfigCacheKey($configId));
 }
 /**
  * Removes item from the cache.
  *
  * @param string $key
  * @return void
  */
 public function remove($key)
 {
     $this->provider->delete($key);
 }
 /**
  * {@inheritdoc}
  */
 public function evict(CacheKey $key)
 {
     return $this->cache->delete($this->name . '_' . $key->hash);
 }
Exemple #25
0
 /**
  * Remove a value from cache
  *
  * @param \Itkg\Core\CacheableInterface $item
  *
  * @return void
  */
 public function remove(CacheableInterface $item)
 {
     $this->provider->delete($item->getHashKey());
 }
Exemple #26
0
 /**
  * {@inheritdoc}
  */
 public function delete($id)
 {
     return $this->provider->delete($id);
 }
Exemple #27
0
 protected function deleteTag($tag)
 {
     $id = $this->getTagId($tag);
     $this->engine->delete($id);
 }
Exemple #28
0
 public function delete($id)
 {
     return $this->driver->delete($id);
 }
Exemple #29
0
 /**
  * @param ConfigIdInterface $configId
  * @param bool              $localCacheOnly
  *
  * @return bool
  */
 public function deleteConfig(ConfigIdInterface $configId, $localCacheOnly = false)
 {
     $cacheKey = $this->buildConfigCacheKey($configId);
     unset($this->localCache[$cacheKey]);
     return $localCacheOnly ? true : $this->cache->delete($cacheKey);
 }
Exemple #30
0
 public static function delete($key, $group = '')
 {
     self::$cacheDriver->setNamespace($group);
     self::$cacheDriver->delete($key);
 }