Jamm\Memory\MemcacheObject::setTags PHP Method

setTags() protected method

protected setTags ( string $key, array | string $tags ) : boolean
$key string
$tags array | string
return boolean
    protected function setTags($key, $tags)
    {
        if (!is_array($tags)) {
            $tags = array($tags);
        }
        foreach ($tags as $tag) {
            $id = $this->tag_prefix . $tag;
            if ($this->acquire_key($id, $AutoUnlocker)) {
                $keys = $this->memcache->get($id);
                $keys[] = $key;
                if (!$this->memcache->set($id, array_unique($keys))) {
                    $this->ReportError('Can\'t set tag ' . $tag . ' for key ' . $key, __LINE__);
                }
            }
        }
        return true;
    }