Sets a new expiration time on an item.

@param string $key The key under which to append the value.
@param int $expiration The expiration time, defaults to 0.

@return bool true on success or false on failure.
350820
public function touch($key, $expiration = 0) {
    $result = $this->get($key, null, $cas_token);
    if ($result) {
      $result = $this->cas($cas_token, $key, $result, $expiration);
    }
    $this->result_code = $result ? self::RES_SUCCESS : self::RES_FAILURE;
    return $result;
  }
965629
public function setExpire(\DateTime $expire = null)
    {
        $this->_expire = ($expire) ? $expire : null;

        return $this;
    }
1079189
public function set($key, $value, $expiration = false)
    {
        $path = $this->filename($key);
        $umask = umask($this->umask);
        file_put_contents($path, $this->createValue($value, $expiration));
        umask($umask);
        return $this;
    }
628150
public function store($key, $value = null, $expiration = 0)
    {
        return $this->set($key, $value, ($expiration ? $expiration : null));
    }
1032496
public function set($key, $value, $expiration = 300) {

		if(false === is_string($key) && false === is_array($key)) {
   			return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string or array, "%s" given', __METHOD__, gettype($key)), E_USER_ERROR);
   		}

   		if(0 === strlen($key)) {
   			return trigger_error(sprintf('Argument 1 passed to %s() may not be an empty string', __METHOD__), E_USER_ERROR);
   		}
   		
		$this -> expire($key);
		apcu_add($key, $value, $expiration);

		return $this;
	}
141247
private function setExpiration($expires_in)
    {
        $this->expiresAtTimestamp = time() + $expires_in;
        $this->expiresAt = date('Y-m-d H:i:s', time() + $expires_in);
    }
1327036
public function set($key, $val, $expire = 0)
    {
        if (!is_numeric($val)) {
            $val = json_encode($val);
        }

        if ($expire) {
            return $this->redis->setex($key, $expire, $val);
        }

        return $this->redis->set($key, $val);
    }
973978
public function expired(string $key): bool
    {
        try {
            return $this->storage->expired($key);
        } catch (BadPacketException $e) {
            return true;
        }
    }
312072
public function expire($key) {

		if(false === is_string($key) && false === is_array($key)) {
   			return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string or array, "%s" given', __METHOD__, gettype($key)), E_USER_ERROR);
   		}

   		if(0 === strlen($key)) {
   			return trigger_error(sprintf('Argument 1 passed to %s() may not be an empty string', __METHOD__), E_USER_ERROR);
   		}

		apcu_delete($key);
		return $this;
	}
473732
public static function set($key, $value = null, $expiration = null)
    {
        if (!self::$instance) {
            return null;
        }

        self::$instance->cache->set($key, $value, $expiration);

        return self::$instance;
    }
224755
public function update($key, $value, $expire = 0)
    {
        $arr = $this->get($key);
        if (!empty($arr)) {
            $arr = array_merge($arr, $value);
            return $this->set($key, $arr, $expire);
        }
        return 0;
    }
706550
public function touch($key, $expiration = null) {

		$files = glob(Path :: get('cache-shared') . $this -> generateName($key));

		if(true === is_array($files) && count($files) > 0) {

			$file = new File($files[0]);
			
			if(null === $expiration) {
				
				$expiration = $this -> extractExpiration($file);
				$expiration = $expiration -> expiration;
			}

			$file -> rename($this -> generateName($key, $expiration));
		}

		return $this;
	}
1095174
public function set(string $key, string $value, int $expire): bool {
		return ($expire === -1) ? $this->driver->set($key, $value) : $this->driver->setex($key, $expire, $value);
	}
538591
public function set($key, $value, $expire = 0)
    {
        return $this->setItem($key, $value, time(), $expire);
    }
766301
public function setExpire($expire)
	{
		if (null !== $expire)
		{
			$this->expire = $expire instanceof \DateTime ? $expire->getTimestamp() : (int) $expire;
		}
		else
		{
			$this->expire = $expire;
		}

		return $this;
	}
498495
public function set($key, $value, $expiration = 300) {

    	if(false === ('-' . intval($expiration) == '-' . $expiration)) {
			return trigger_error(sprintf('Argument 3 passed to %s() must be of the type integer, "%s" given', __METHOD__, gettype($expiration)), E_USER_ERROR);
		}
    	
    	$this -> call() -> set($key, $value, $expiration);
    	return $this;
    }
235471
public function store($key, $value, $expiry=0) {
		if ($expiry == 0) {
			$expiry = $this->expiry;
		}
		$entry = new CacheItem();

		$entry->value = serialize($value);
		$entry->expireAt = time() + $expiry;
		$data = serialize($entry);

		$this->store->store($key, $data);

		$this->items[$key] = $entry;
	}