src/Cache.php
public function set($key, $value, $ttl = null, $dependency = null): bool
    {
        if ($dependency !== null) {
            $dependency->evaluateDependency($this);
            $value = [$value, $dependency];
        }
        $key = $this->buildKey($key);
        return $this->_handler->set($key, $value, $ttl);
    }
public function set($key, $value, $ttl = null, $dependency = null): bool
    {
        if ($dependency !== null) {
            $dependency->evaluateDependency($this);
            $value = [$value, $dependency];
        }
        $key = $this->buildKey($key);
        return $this->_handler->set($key, $value, $ttl);
    }
public function set ( $ key , $ value , $ ttl = null , $ dependency = null ) : bool { if ( $ dependency !== null ) { $ dependency -> evaluateDependency ( $ this ) ; $ value = [ $ value , $ dependency ] ; } $ key = $ this -> buildKey ( $ key ) ; return $ this -> _handler -> set ( $ key , $ value , $ ttl ) ; }
Stores a value identified by a key into cache.
If the cache already contains such a key, the existing value and
expiration time will be replaced with the new ones, respectively.

@param mixed $key a key identifying the value to be cached. This can be a simple string or
a complex data structure consisting of factors representing the key.
@param mixed $value the value to be cached
@param null|int|\DateInterval $ttl the TTL value of this item. If not set, default value is used.
@param Dependency $dependency dependency of the cached item. If the dependency changes,
the corresponding value in the cache will be invalidated when it is fetched via [[get()]].
This parameter is ignored if [[serializer]] is false.
@return bool whether the value is successfully stored into cache
Stores a value identified by a key into cache . If the cache already contains such a key the existing value and expiration time will be replaced with the new ones respectively .