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

flush() public method

Remove all items from the cache.
public flush ( $all = false )
    public function flush($all = false)
    {
        $this->memory = array();
        if (empty($this->tags) or $all == true) {
            if (is_dir($this->directory)) {
                $this->rmdir($this->directory);
            }
        } else {
            foreach ($this->tags as $tag) {
                if (in_array($tag, $this->deleted_tags)) {
                    //   break;
                }
                $items = $this->forgetTags($tag);
                $del = $this->directory . '/' . $tag;
                $del = $this->normalize_path($del);
                $this->rmdir($del);
            }
        }
    }

Usage Example

Beispiel #1
0
 /**
  * Remove all items from the cache.
  *
  * @param  string $tag
  *
  * @return void
  */
 public function flush($all = false)
 {
     return $this->adapter->flush($all);
 }