Back to MemcachedStorage class

Method remove

public bool
remove
(mixed $id, mixed $group)
Remove a cached data entry by ID and group
Parameters
  • string $id The cache data ID
  • string $group The cache data group
Returns
  • bool
Since
  • 3.0.0

Method remove - Source code

/**
 * Remove a cached data entry by ID and group
 *
 * @param   string  $id     The cache data ID
 * @param   string  $group  The cache data group
 *
 * @return  boolean
 *
 * @since   3.0.0
 */
public function remove($id, $group)
{
    $cache_id = $this->_getCacheId($id, $group);
    if (!$this->lockindex()) {
        return false;
    }
    $index = static::$_db->get($this->_hash . '-index');
    if (\is_array($index)) {
        foreach ($index as $key => $value) {
            if ($value->name == $cache_id) {
                unset($index[$key]);
                static::$_db->set($this->_hash . '-index', $index, 0);
                break;
            }
        }
    }
    $this->unlockindex();
    return static::$_db->delete($cache_id);
}