float CRedisClient::hincrbyfloat(const string &key, const string &field, float increment) { CResult result; hincrbyfloat( key, field, increment,result ); ReplyType type = result.getType(); if ( REDIS_REPLY_ERROR == type ) { throw ReplyErr( result.getErrorString() ); }else if ( REDIS_REPLY_STRING != type ) { throw ProtocolErr( "HINCRBYFLOAT: data recved is not string" ); } return _valueFromString<float>( result.getString() ); }
bool CRedisClient::get( const std::string &key, std::string &value ) { value.clear(); CResult result; get( key, result ); ReplyType type = result.getType(); if ( type == REDIS_REPLY_ERROR ) { throw ReplyErr( result.getErrorString() ); }else if ( type == REDIS_REPLY_NIL ) { return false; }else if ( type == REDIS_REPLY_STRING ) { value = result.getString(); return true; }else { throw ProtocolErr( "GET: data recved is not string" ); } }