自增

@param mixed $key 要自增的缓存的数据的key
@param int $val 自增的进步值,默认为1

@return bool
765725
public function increment($key, $val = 1)
    {
        $this->type === 2 && $key = $this->conf['prefix'] . $key;
        return $this->memcache->increment($key, abs(intval($val)));
    }
545622
public static function set(array $root, string $key, $val){
        $origin = $root;
        $node   = &$root;

        foreach(explode(".", $key) as $key){
            if(!is_array($key) || !array_key_exists($key, $node)){
                return $origin;
            }

            $node   = &$node[$key];
        }

        $node   = $val;

        return $root;
    }
880997
public function add($key, $val)
    {
      if (is_array($key))
        foreach($key as $k)
          $this->data[$k] = $val;
      else
        if (is_array($val))
          $this->data[$key] = $val;
      else
        $this->data[$key] = (string) $val;
    }
797951
public function emit($val, $key = null)
    {
        $this->_result[$key === null ? $this->_counter : $key] = $val;
        $this->_counter++;
    }
944932
public function config($key, $val = null, $default = null)
    {
        if ($val == null) {
            return Config::get($key, $default);
        } else {
            Config::set($key, $val);
        }
    }
348487
public static function setContextDataByKey(string $key, $val)
    {
        $coroutineId = self::getcoroutine();
        self::$coroutineLocal[$coroutineId][self::COROUTINE_DATA][$key] = $val;
    }
1185159
public function set($key, $val = null)
    {
        if (is_array($key)) {
            $this->_setpost = array_merge($this->_setpost, $key);
        } else {
            $this->_setpost[$key] = $val;
        }
        return $this;
    }
226078
public function addElement($key, $val)
    {
        $this->myData = array_merge($this->myData, array((String)$key => $val));
    }
328870
public function pushLog($key, $val)
    {
        if (! $this->enable || ! (\is_string($key) || is_numeric($key))) {
            return;
        }

        $key = urlencode($key);
        $cid = Coroutine::tid();
        if (\is_array($val)) {
            $this->pushlogs[$cid][] = "$key=" . json_encode($val);
        } elseif (\is_bool($val)) {
            $this->pushlogs[$cid][] = "$key=" . var_export($val, true);
        } elseif (\is_string($val) || is_numeric($val)) {
            $this->pushlogs[$cid][] = "$key=" . urlencode($val);
        } elseif (null === $val) {
            $this->pushlogs[$cid][] = "$key=";
        }
    }
24655
public function setAttribute($key, $val)
    {
        if(is_null($val) && array_key_exists($key, $this->attributes))
            unset($this->attributes[$key]);
        else
            $this->attributes[$key] = $val;
    }
49969
public function arrayKeyValueFunc($key, $val, $current_array = null)
    {
        if (empty($current_array)) {
            return array($key => $val);
        }

        $current_array[$key] = $val;

        return $current_array;
    }
834312
function set($key,$val) {
		$key=$this->fixheader($key);
		return $this->headers[$key]=$val;
	}
68329
public function set($key, $val, $expt = 0)
    {
        $valueString = serialize($val);
        $keyString = $this->getKey($key);

        $this->writeSocket(
            "set $keyString 0 $expt " . strlen($valueString)
        );
        $s = $this->writeSocket($valueString, true);

        if ('STORED' == $s) {
            $this->resultCode = Memcached::RES_SUCCESS;
            $this->resultMessage = '';
            return true;

        } else {
            $this->resultCode = Memcached::RES_FAILURE;
            $this->resultMessage = 'Set fail.';
            return false;
        }
    }
796208
public static function arrList($val): bool
    {
        if (!$val || !\is_array($val)) {
            return false;
        }

        /** @var array $val */
        foreach ($val as $k => $v) {
            if (!\is_array($v)) {
                return false;
            }
        }

        return true;
    }
770993
protected function _validate($key, $val)
    {
        // try each rule function
        foreach ($this->rules as $rule => $is_true) {
            if ($is_true) {
                $function = $this->functions[$rule];
                $args = $this->arguments[$rule]; // Arguments of rule

                $valid = true;
                if(is_array($val)) {
                    foreach($val as $v) {
                        $valid = $valid && (empty($args)) ? $function($v) : $function($v, $args);
                    }
                } else {
                    $valid = (empty($args)) ? $function($val) : $function($val, $args);
                }

                if ($valid === FALSE) {
                    $this->registerError($rule, $key);

                    $this->rules = array();  // reset rules
                    $this->filters = array();
                    return FALSE;
                }
            }
        }

        $this->validData[$key] = $val;
        return TRUE;
    }
1144920
public function setDefaultData($key, $val = null)
    {
        if(is_array($key))
        {
            foreach($key as $k=>$v)
            {
                $this->setDefaultData($k, $v);
            }
        }
        else
        {
            $this->defaultData[$key] = $val;
        }

        return $this;
    }
897413
public function increment($key, $val = 1, $field = null, $tablePrefix = null)
    {
        list($tableName, $condition) = $this->parseKey($key, true);
        if (is_null($field) || empty($tableName) || empty($condition)) {
            return false;
        }
        $val = abs(intval($val));
        is_null($tablePrefix) && $tablePrefix = $this->tablePrefix;
        $tableName = $tablePrefix . $tableName;

        $bulk = new BulkWrite();
        $bulk->update($condition, ['$inc' => [$field => $val]], ['multi' => true]);
        $result = $this->runMongoBulkWrite($tableName, $bulk);

        Cml::$debug && $this->debugLogSql('BulkWrite INC', $tableName, $condition, ['$inc' => [$field => $val]]);

        return $result->getModifiedCount();
    }