yii\caching\MemCache::setValue PHP Method

setValue() protected method

This is the implementation of the method declared in the parent class.
See also: [Memcache::set()](http://php.net/manual/en/memcache.set.php)
protected setValue ( string $key, mixed $value, integer $duration ) : boolean
$key string the key identifying the value to be cached
$value mixed the value to be cached.
$duration integer the number of seconds in which the cached value will expire. 0 means never expire.
return boolean true if the value is successfully stored into cache, false otherwise
    protected function setValue($key, $value, $duration)
    {
        // Use UNIX timestamp since it doesn't have any limitation
        // @see http://php.net/manual/en/memcache.set.php
        // @see http://php.net/manual/en/memcached.expiration.php
        $expire = $duration > 0 ? $duration + time() : 0;
        return $this->useMemcached ? $this->_cache->set($key, $value, $expire) : $this->_cache->set($key, $value, 0, $expire);
    }