bool CRedisClient::hsetnx(const string &key, const string &field, const string &value)
{
    CResult result;
    hsetnx( key, field, value,result );

    ReplyType type = result.getType();
    if ( REDIS_REPLY_ERROR == type )
    {
        throw ReplyErr( result.getErrorString() );
    }else if ( REDIS_REPLY_INTEGERER != type )
    {
        throw ProtocolErr( "HSETNX: data recved is not intergerer" );
    }
    return ( result.getInt()==1?true:false );
}
uint64_t CRedisClient::hlen(const string &key)
{
   CResult result;
   hlen( key, result );

   ReplyType type = result.getType();
   if ( REDIS_REPLY_ERROR == type )
   {
        throw ReplyErr( result.getErrorString() );
   }else if ( REDIS_REPLY_INTEGERER != type )
   {
        throw ProtocolErr( "HLEN: data recved is not intergerer" );
   }
   return result.getInt();
}
uint64_t CRedisClient::hincrby(const string &key, const string &field, uint64_t increment)
{
    CResult result;
    hincrby( key, field, increment,result );

    ReplyType type = result.getType();
    if ( REDIS_REPLY_ERROR == type )
    {
        throw ReplyErr( result.getErrorString() );
    }else if ( REDIS_REPLY_INTEGERER != type )
    {
        throw ProtocolErr( "HINCRBY: data recved is not intgerer" );
    }
    return result.getInt();
}
bool CRedisClient::hexists(const string &key, const string &field)
{
    CResult result;
    hexists( key, field, result );

    ReplyType type = result.getType();

    if ( REDIS_REPLY_ERROR == type )
    {
        throw ReplyErr( result.getErrorString() );
    }else if ( REDIS_REPLY_INTEGERER != type )
    {
        throw ProtocolErr( "HEXISTS: data recv is not intgerer" );
    }
    return result.getInt();
}
uint64_t CRedisClient::hdel( const string &key, const CRedisClient::VecString &fields )
{
    CResult result;
    hdel( key, fields, result );

    ReplyType type = result.getType();

    if ( REDIS_REPLY_ERROR == type )
    {
        throw ReplyErr( result.getErrorString() );
    }else if ( REDIS_REPLY_INTEGERER != type )
    {
        throw ProtocolErr( "HDEL: data recv is not intgerer" );
    }
    return result.getInt();
}
uint8_t CRedisClient::hset(const std::string &key, const std::string &field, const std::string &value)
{
    CResult result;

   hset( key, field, value, result );
   ReplyType type = result.getType();
   if ( type == REDIS_REPLY_ERROR )
   {
        throw ReplyErr( result.getErrorString() );
   }

   if ( type != REDIS_REPLY_INTEGERER )
   {
       throw ProtocolErr( "HSET: data recved is not integerer" );
   }
   return result.getInt();
}