uint64_t CRedisClient::stringToVecString(string& str, CRedisClient::VecString& vec)
{
    uint64_t i=0;
    uint64_t len=str.length();
    uint64_t posStart=0;
    while(i<len)
    {
        if (str[i]=='\n')
        {
            vec.push_back(str.substr(posStart,i-posStart));
            posStart=i+1;
        }
        ++i;
    }
    return vec.size();

}
uint64_t CRedisClient::hkeys(const string &key, CRedisClient::VecString &values)
{
    CResult result;
    hkeys( key, result );

    ReplyType type = result.getType();
   if ( REDIS_REPLY_ERROR == type )
   {
       throw ReplyErr( result.getErrorString() );
   }else if ( REDIS_REPLY_ARRAY != type )
   {
        throw ProtocolErr("HKEYS: data recved is not arry");
   }

   _getValueFromArry( result.getArry(), values );
   return values.size();
}
uint64_t CRedisClient::hvals(const string &key, CRedisClient::VecString &values)
{
    CResult result;
    hvals( key, result );

    ReplyType type = result.getType();
    if ( REDIS_REPLY_ERROR == type )
    {
        throw ReplyErr( result.getErrorString() );
    }else if ( REDIS_REPLY_ARRAY != type )
    {
        throw ProtocolErr( "HVALS: data recved is not arry");
    }
    CResult::ListCResult::const_iterator it = result.getArry().begin();
    CResult::ListCResult::const_iterator end = result.getArry().end();
    for ( ; it != end; ++it )
    {
        values.push_back( static_cast<string>(*it) );
    }
    return values.size();
}