src/SimpleCacheTrait.php
public function set($key, $value, $ttl = null)
    {
        $item = new Item($key, $value);
        if ($ttl !== null) {
            $item->expiresAfter($ttl);
        }
        return $this->save($item);
    }
public function set($key, $value, $ttl = null)
    {
        $item = new Item($key, $value);
        if ($ttl !== null) {
            $item->expiresAfter($ttl);
        }
        return $this->save($item);
    }
public function set ( $ key , $ value , $ ttl = null ) { $ item = new Item ( $ key , $ value ) ; if ( $ ttl !== null ) { $ item -> expiresAfter ( $ ttl ) ; } return $ this -> save ( $ item ) ; }
Persists data in the cache, uniquely referenced by a key.

@param string $key The key of the item to store
@param mixed $value The value of the item to store, must be serializable
@param \DateInterval|int|null $ttl The TTL value of this item

@return bool
Persists data in the cache uniquely referenced by a key .