MCPcopy Create free account
hub / github.com/cc20110101/RedisView / command

Method command

src/RedisView/RedisLib/RedisClient.cpp:136–164  ·  view source on GitHub ↗

* 发送REDIS命令到服务端 * @param[in] str 命令 * @return 服务端RESP协议返回值 * @see * @note */

Source from the content-addressed store, hash-verified

134 * @note
135 */
136QByteArray RedisClient::command(const QString & str) {
137 if(str.trimmed().isEmpty()) {
138 return "-str is empty\r\n";
139 }
140
141 _msg.clear();
142 _sErrorInfo.clear();
143 _sendData.clear();
144 _bTimeout = false;
145 packRespCmd(str,_sendData);
146 if(_sendData.isEmpty()) {
147 return "-pack resp cmd is empty\r\n";
148 }
149
150 _redisTransMgr->write(_sendData);
151
152 if(!_qTimer.isActive())
153 _qTimer.start();
154 _qEventloop.exec();
155 if(_qTimer.isActive())
156 _qTimer.stop();
157
158 if (_bTimeout) {
159 _sErrorInfo = "-run " + str + " timeout\r\n";
160 return QByteArray(_sErrorInfo.toUtf8());
161 }
162
163 return _msg;
164}
165
166/**
167 * 发送REDIS命令到服务端

Callers 2

runMethod · 0.45

Calls 2

writeMethod · 0.80
clearMethod · 0.45

Tested by

no test coverage detected