获取在线用户总数


@return boolean
964350
public CompletableFuture<Integer> getUserSize() {
        if (this.localEngine != null && this.sncpNodeAddresses == null) {
            return CompletableFuture.completedFuture(this.localEngine.getLocalUserSize());
        }
        tryAcquireSemaphore();
        CompletableFuture<Integer> rs = this.sncpNodeAddresses.queryKeysStartsWithAsync(SOURCE_SNCP_USERID_PREFIX).thenApply(v -> v.size());
        if (semaphore != null) rs.whenComplete((r, e) -> releaseSemaphore());
        return rs;
    }
1310079
public function delete()
    {
        if ($this->exists && $deleted = $this->service->delete($this->getId())) {
            $this->setAttributes($deleted->toArray());
            return !$this->exists = false;
        }
        return false;
    }
544093
public function flush()
    {
        if (empty($this->memcache)) {
            return false;
        }

        $flushStatus = $this->memcache->flush();

        return $flushStatus;
    }
1284950
public function valid()
	{
		if(!isset($this->lines[$this->position])){
			return false;
		}
		if(count($this->lines[$this->position])===0){
			return false;
		}
		return true;
	}
1261635
public function isValid() {
        if($this->isRequired()) {
            if($this->getValue() == null) return false;
            if($this->getValue() == "") return false;
        }
        return true;
    }
1239734
public function isValid()
    {
        $response = call_user_func_array($this->userFunction, array(
            &$this->field
        ));

        if ($response === true) {
            return true;
        }

        if (is_string($response)) {
            $this->setErrorMessage($response);
        }

        return false;
    }
911880
public function isValid()
    {
        $valid = true;
        $messages = array();

        /** @var Input $input */
        foreach ($this->_inputs as $input) {
            if (!$input->isValid()) {
                $valid = false;
                $messages[$input->name] = $input->getMessages();
            }
        }
        $this->_messages = $messages;
        return $valid;
    }
1202305
public function isValid ()
    {
        return !$this->isEmpty() && !Helper::some($this->getFields(), function (Field $field) { return $field->isEmpty(); });
    }
1044063
public function isValid() {
        if ($this->isValid === null) $this->isValid = $this->validate();
        return $this->isValid;
    }
194443
public function valid()
    {
        if ($this->_buffer->offsetExists($this->_index)) {
            $current = $this->_buffer->offsetGet($this->_index);
            $this->_current = $current['value'];
            $this->_key = $current['key'];

            return true;
        }

        $valid = parent::valid();

        if ($valid) {
            $this->_current = parent::current();
            $this->_key = parent::key();
            $this->_buffer->push([
                'key' => $this->_key,
                'value' => $this->_current
            ]);
        }

        $this->_finished = !$valid;

        return $valid;
    }
1368910
public function is()
	{
		foreach (func_get_args() as $pattern)
		{
			if (str_is($pattern, $this->path()))
			{
				return true;
			}
		}

		return false;
	}
659589
public function start() {
        if ($this->dialect) {
            //允许事务嵌套
            $this->transLevel += 1;
            $dialect          = $this->dialect;
            if ($dialect->inTransaction()) {
                return true;
            }
            $rst = $dialect->beginTransaction();
            if ($rst) {
                return true;
            } else {
                $this->transLevel -= 1;
            }
        }

        return false;
    }
344008
public function validate()
    {
        $confirmationInput = $this->inputName.'_confirmation';

        if (isset($this->input[$confirmationInput]) &&
            $this->input[$confirmationInput] == $this->getValue()) {
            return true;
        }

        return false;
    }
285053
public function flush() {
        // 缓存不存在则查询数据表信息
        $this->db->setModel($this->name);
        $fields =   $this->db->getFields($this->getTableName());
        if(!$fields) { // 无法获取字段信息
            return false;
        }
        $this->fields   =   array_keys($fields);
        unset($this->fields['_pk']);
        foreach ($fields as $key=>$val){
            // 记录字段类型
            $type[$key]     =   $val['type'];
            if($val['primary']) {
                  // 增加复合主键支持
                if (isset($this->fields['_pk']) && $this->fields['_pk'] != null) {
                    if (is_string($this->fields['_pk'])) {
                        $this->pk   =   array($this->fields['_pk']);
                        $this->fields['_pk']   =   $this->pk;
                    }
                    $this->pk[]   =   $key;
                    $this->fields['_pk'][]   =   $key;
                } else {
                    $this->pk   =   $key;
                    $this->fields['_pk']   =   $key;
                }
                if($val['autoinc']) $this->autoinc   =   true;
            }
        }
        // 记录字段类型信息
        $this->fields['_type'] =  $type;

        // 2008-3-7 增加缓存开关控制
        if(C('DB_FIELDS_CACHE')){
            // 永久缓存数据表信息
            $db   =  $this->dbName?:C('DB_NAME');
            F('_fields/'.strtolower($db.'.'.$this->tablePrefix.$this->name),$this->fields);
        }
    }
99173
public function delete()
    {
        $transaction = static::getDb()->beginTransaction();
        try {
            $result = $this->deleteInternal();

            if ($result !== false && $this->migration) { // 有迁移执行迁移脚本
                $result = $this->migration(self::MIGRATION_UNINSTALL);
            }

            if ($result === false) {
                $transaction->rollBack();
            } else {
                $transaction->commit();

                static::updateCache();
            }
            return $result;
        } catch (\Exception $e) {
            $transaction->rollBack();
            throw $e;
        }
    }
1355354
public function delete(): bool
    {
        if (! $this->exists())
        {
            return false;
        }

        $sql = 'DELETE FROM ' . $this->getTableName() . ' WHERE ' . $this->getKeyName() . ' = :key';
        $query = DB::getConnection()->prepare($sql);

        return $query->execute(['key' => $this->getKey()]);
    }
780026
public function exists()
    {
        $returnValue = (bool) false;
        try{
        	$returnValue = count($this->getTypes())?true:false;
        }
        catch(Exception $e){
        	;//return false by default
        }
        return (bool) $returnValue;
    }