public function setItemToDate(string $key, $value, \DateTimeInterface $date): bool
    {
        $ttl = $date->getTimestamp() - \time();

        if ($ttl <= 0) {
            throw new InvalidArgumentException('Date in the past.');
        }

        return $this->setItem($key, $value, $ttl);
    }
public function setItemToDate(string $key, $value, \DateTimeInterface $date): bool
    {
        $ttl = $date->getTimestamp() - \time();

        if ($ttl <= 0) {
            throw new InvalidArgumentException('Date in the past.');
        }

        return $this->setItem($key, $value, $ttl);
    }
public function setItemToDate ( string $ key , $ value , \ DateTimeInterface $ date ) : bool { $ ttl = $ date -> getTimestamp ( ) - \ time ( ) ; if ( $ ttl <= 0 ) { throw new InvalidArgumentException ( 'Date in the past.' ) ; } return $ this -> setItem ( $ key , $ value , $ ttl ) ; }
Set cache-item by key => value + date.

@param string             $key
@param mixed              $value
@param \DateTimeInterface $date <p>If the date is in the past, we will remove the existing cache-item.</p>

@throws InvalidArgumentException
<p>If the $date is in the past.</p>

@return bool
Set cache - item by key = > value + date .