yii\caching\Cache::madd PHP Method

madd() public method

If the cache already contains such a key, the existing value and expiration time will be preserved.
Deprecation: This method is an alias for [[multiAdd()]] and will be removed in 2.1.0.
public madd ( array $items, integer $duration, yii\caching\Dependency $dependency = null ) : array
$items array the items to be cached, as key-value pairs.
$duration integer default number of seconds in which the cached values will expire. 0 means never expire.
$dependency yii\caching\Dependency dependency of the cached items. If the dependency changes, the corresponding values in the cache will be invalidated when it is fetched via [[get()]]. This parameter is ignored if [[serializer]] is false.
return array array of failed keys
    public function madd($items, $duration = 0, $dependency = null)
    {
        return $this->multiAdd($items, $duration, $dependency);
    }

Usage Example

コード例 #1
0
 /**
  * @param array      $items
  * @param integer    $duration
  * @param Dependency $dependency
  *
  * @return boolean
  *
  * @see yii\caching\Cache::madd()
  */
 public function madd($items, $duration = 0, $dependency = NULL)
 {
     return $this->cache->madd($items, $duration, $dependency);
 }