* 给定一个或多个脚本的SHA1校验和,返回一个包含0和1的列表,表示校验和所指定的脚本是否已经被保存在缓存当中 * @param[in] script 一个或多个SHA1校验和,空格分割 * @param[out] value 结果列表 * @return 成功true,失败false * @see * @note */
| 4036 | * @note |
| 4037 | */ |
| 4038 | bool RedisClient::scriptexists(const QString & script, QList<QByteArray> & value) { |
| 4039 | _sErrorInfo.clear(); |
| 4040 | if(script.trimmed().isEmpty()) { |
| 4041 | _sErrorInfo = "script is empty"; |
| 4042 | return false; |
| 4043 | } |
| 4044 | |
| 4045 | _vCmdList.clear(); |
| 4046 | _vCmdList.push_back("SCRIPT"); |
| 4047 | _vCmdList.push_back("EXISTS"); |
| 4048 | _vCmdList.push_back(script); |
| 4049 | |
| 4050 | _cmdResult = command(_vCmdList); |
| 4051 | if(_cmdResult[0] == '-') { |
| 4052 | if(parseRespError(_cmdResult,_sValue)) |
| 4053 | _sErrorInfo = _sValue; |
| 4054 | else |
| 4055 | _sErrorInfo = "parser resp error info failed"; |
| 4056 | _bRet = false; |
| 4057 | } else if(_cmdResult[0] == '*') { |
| 4058 | if(parseRespSingelArray(_cmdResult,value, _iRet)) { |
| 4059 | _bRet = true; |
| 4060 | } else { |
| 4061 | _sErrorInfo = "parser resp single array info failed"; |
| 4062 | _bRet = false; |
| 4063 | } |
| 4064 | } else { |
| 4065 | _bRet = false; |
| 4066 | _sErrorInfo = QString("parser resp type failed:") + _cmdResult[0]; |
| 4067 | } |
| 4068 | return _bRet; |
| 4069 | } |
| 4070 | |
| 4071 | /** |
| 4072 | * 返回哈希表 key 中的所有域 |