Microweber\Utils\Adapters\Cache\Storage\FileStorage::forgetTags PHP Method

forgetTags() public method

Remove an item from the cache by tags.
public forgetTags ( string $string )
$string string
    public function forgetTags($string)
    {
        $string_array = explode(',', $string);
        if (is_array($string_array)) {
            foreach ($string_array as $k => $v) {
                $string_array[$k] = trim($v);
            }
        }
        foreach ($string_array as $sa) {
            $this->deleted_tags[] = $sa;
            $file = $this->directoryTags . '/' . $sa;
            if ($this->files->exists($file)) {
                $farr = file($file);
                foreach ($farr as $f) {
                    if ($f != false) {
                        $f = $this->normalize_path($f, false);
                        if (is_file($f)) {
                            @unlink($f);
                        }
                    }
                }
                @unlink($file);
            }
        }
    }

Usage Example

Beispiel #1
0
 /**
  * Remove an item from the cache by tags.
  *
  * @param  string $string
  *
  * @return void
  */
 public function forgetTags($string)
 {
     return $this->adapter->forgetTags($string);
 }