src/Psr16Manager.php
public function set(string $key, $value, int $ttl = null)
    {
        $keyNormalized = $this->normalized($key);

        $result = static::$handler->set($keyNormalized, $value, $ttl ?? $this->ttl);

        if ($result) {
            if ($this->assistant) {
                $this->assistant->add($keyNormalized);
                $this->assistant->save();
            }
        }

        return $result;
    }
public function set(string $key, $value, int $ttl = null)
    {
        $keyNormalized = $this->normalized($key);

        $result = static::$handler->set($keyNormalized, $value, $ttl ?? $this->ttl);

        if ($result) {
            if ($this->assistant) {
                $this->assistant->add($keyNormalized);
                $this->assistant->save();
            }
        }

        return $result;
    }
Store an item in the cache.

@param string                               $key   键
@param mixed                                $value 值
@param \DateTimeInterface|\DateInterval|int $ttl   生命值，秒

@return bool