Jamm\Memory\APCObject::del_by_tags PHP Method

del_by_tags() public method

Delete keys by tags
public del_by_tags ( array | string $tags ) : boolean
$tags array | string - tag or array of tags
return boolean
    public function del_by_tags($tags)
    {
        if (!is_array($tags)) {
            $tags = array($tags);
        }
        $todel = array();
        $l = strlen($this->tags_prefix);
        $i = new \APCIterator('user', '/^' . preg_quote($this->tags_prefix) . '/', APC_ITER_KEY + APC_ITER_VALUE);
        foreach ($i as $key_tags) {
            if (is_array($key_tags[self::apc_arr_value])) {
                $intersect = array_intersect($tags, $key_tags[self::apc_arr_value]);
                if (!empty($intersect)) {
                    $todel[] = substr($key_tags[self::apc_arr_key], $l);
                }
            }
        }
        if (!empty($todel)) {
            return $this->del($todel);
        }
        return true;
    }