Store an item.

@param  string $key
@param  mixed $value
@return bool

@triggers setItem.pre(PreEvent)
@triggers setItem.post(PostEvent)
@triggers setItem.exception(ExceptionEvent)
501239
public function setItem($key, $value)
    {
        if (!$this->getOptions()->getEnabled()) {
            return false;
        }

        $this->normalizeKey($key);

        $result = false;
        try {
            $result = $this->internalSetItem($key, $value);
        } catch (\Exception $e) {
        }

        return $result;
    }
923563
public function setPost($key, $value = null)
    {
        if (is_array($key)) {
            $_POST = $key;
        } else {
            $_POST[$key] = $value;
        }
        return $this;
    }
611316
public function define($key, $value)
    {

        if ($this->isProtected($key)) {

            throw new \UnexpectedValueException("Cannot re-assing protected '$key' item");
        }

        parent::set($key, $value);

        $this->protect($key);

        return $this;
    }
1181992
public function bind($key, $value)
    {
        $this->key[$key] = true;

        $this[$key] = $value;
    }
1095492
public function set($key, $value)
	{
		$key = $this->normalizeKey($key);

		$this->items[$key] = $this->normalizeValue($value);

		return $this->items[$key];
	}
1262954
public static function set(string $key, $value)
    {
        if (!in_array($key, self::$allowedKeys)) {
            throw new \InvalidArgumentException('Invalid key given');
        }

        self::$storedValues[$key] = $value;
    }
121275
protected function storeToStash($key, $value)
    {
        $this->items[$key] = $this->sanitizeStashStorageItem($value, $key);
    }
950620
public function set( $key, $value )
	{
		return $this->store->set( $key, $value, 0, $this->expires );
	}
628150
public function store($key, $value = null, $expiration = 0)
    {
        return $this->set($key, $value, ($expiration ? $expiration : null));
    }
387244
public function set($key, $value)
    {
        $hash = $this->key_to_hash($key);
        $this->array[$hash] = $value;
        return $this;
    }
1137556
public function set($key, $value)
    {
        $item = $this->pool->getItem($key);
        $item->set($this->serializer->serialize($value), $this->expire);
    }
1018949
public function set($key, $value)
        {
            if (!$this->enabled) {
                return false;
            }

            switch ($this->type) {
                case self::TYPE_APC:
                    apc_store($key, $value);
                    break;
                case self::TYPE_FILE:
                    $filename = $this->path . $key . '.cache';
                    file_put_contents($filename, serialize($value));
                    break;
            }


            return true;
        }
721313
function set($item, $value)
    {
        if (isset($this->$item)) {
            $this->$item = $value;
            return $this;
        }
        return false;
    }
655681
protected function setState($key, $value)
    {
        $this->getStateStorage()->set($this->getStateKeyPrefix() . $key, $value);
        return $this;
    }
1087076
public function set($key, $value)
    {
        $this->store[$key] = $value;

        return setcookie($key, $value);
    }
631405
public function set($key, $value)
    {
        $setResult = $this->getClient()->set($key, $value);
        if ($setResult === false) {
            throw new \Exception($this->getClient()->getResultMessage(), $this->getClient()->getResultCode());
        }
        return $setResult;
    }
192100
public function set($key, $value) {
    if ($this->exists($key)) {
      $index = $this->getKeyPosition($key);
      $this->values[$index] = $value;
      return $this;
    }
    return $this->add($key, $value);
  }