• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ credisclient::VecString类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中credisclient::VecString的典型用法代码示例。如果您正苦于以下问题:C++ VecString类的具体用法?C++ VecString怎么用?C++ VecString使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了VecString类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: hmget

void CRedisClient::hmget(const string &key, const CRedisClient::VecString &fields, CResult &result)
{
    _socket.clearBuffer();
    Command cmd( "HMGET" );
    cmd << key;

    VecString::const_iterator it = fields.begin();
    VecString::const_iterator end = fields.end();
    for ( ; it != end; ++it )
    {
        cmd << *it;
    }

    _sendCommand( cmd );
    _getReply( result );

    ReplyType type = result.getType();
    if ( REDIS_REPLY_ERROR == type )
    {
        throw ReplyErr( result.getErrorString() );
    }else if ( REDIS_REPLY_ARRAY != type )
    {
        throw ProtocolErr( "HMGET: data recved is not arry" );
    }
}
开发者ID:RedisCppTeam,项目名称:RedisCpp-hiredis,代码行数:25,代码来源:RedisClientHash.cpp


示例2: TestPfmerge

void TestPfmerge( void )
{
	try
	{
		CRedisClient redis;
		redis.connect("127.0.0.1", 6379);

		CRedisClient::VecString element;
		element.push_back("a");
		element.push_back("b");
		element.push_back("c");
		string key1("key1");
		redis.pfadd(key1, element);

		CRedisClient::VecString element2;
		element2.push_back("a");
		element2.push_back("d");
		string key2("key2");
		redis.pfadd(key2, element2);

		CRedisClient::VecString keys;
		keys.push_back(key1);
		keys.push_back(key2);
		bool flag = redis.pfmerge("test", keys);
		cout << flag << endl;
	} catch( RdException& e )
	{
		std::cout << "Redis exception:" << e.what() << std::endl;
	} catch( Poco::Exception& e )
	{
		std::cout << "Poco_exception:" << e.what() << std::endl;
	}
}
开发者ID:RedisCppTeam,项目名称:redis-client,代码行数:33,代码来源:testHyperLogLog.cpp


示例3: TestLrange

void TestLrange( void )
{
	try
	{
		CRedisClient redis;
		redis.connect("127.0.0.1", 6379);
		string mykey = "key";

		CRedisClient::VecString value;
		int64_t start = 0;
		int64_t stop = 33;
		uint64_t count = redis.lrange(mykey, start, stop, value);
		std::cout << count << std::endl;
		CRedisClient::VecString::const_iterator it = value.begin();
		CRedisClient::VecString::const_iterator end = value.end();
		while ( it != end )
		{
			cout << *it << endl;
			++it;
		}
	} catch( RdException& e )
	{
		std::cout << "Redis exception:" << e.what() << std::endl;
	} catch( Poco::Exception& e )
	{
		std::cout << "Poco_exception:" << e.what() << std::endl;
	}
}
开发者ID:nanrenhaiyang,项目名称:redis-client,代码行数:28,代码来源:testList.cpp


示例4: PrintVector

void PrintVector( const string& key,CRedisClient::VecString& values )
{
    CRedisClient::VecString::const_iterator it = values.begin();
    CRedisClient::VecString::const_iterator end = values.end();
    for ( ; it != end; ++it )
    {
        std::cout << key << ": " << *it << std::endl;
    }
}
开发者ID:nanrenhaiyang,项目名称:redis-client,代码行数:9,代码来源:testSet.cpp


示例5: sinter

uint64_t CRedisClient::sinter(const CRedisClient::VecString &keys, VecString &values)
{
    Command cmd( "SINTER" );
    VecString::const_iterator it = keys.begin();
    VecString::const_iterator end = keys.end();
    for ( ; it != end; ++it )
    {
        cmd << *it;
    }

    return ( _getArry( cmd, values ) );
}
开发者ID:nanrenhaiyang,项目名称:redis-client,代码行数:12,代码来源:RedisClientSet.cpp


示例6: slowlog

void CRedisClient::slowlog(const CRedisClient::VecString &subcommand, CResult &reply)
{
    Command cmd( "SLOWLOG" );
    _socket.clearBuffer();
    VecString::const_iterator it = subcommand.begin();
    VecString::const_iterator  end=subcommand.end();
    for ( ; it !=end; ++it )
    {
        cmd << *it;
    }
    _sendCommand(cmd);
    _getReply(reply);
}
开发者ID:nanrenhaiyang,项目名称:redis-client,代码行数:13,代码来源:RedisClientServer.cpp


示例7: sunion

uint64_t CRedisClient::sunion(const CRedisClient::VecString &keys , VecString &members)
{
    Command cmd( "SUNION" );

    VecString::const_iterator it = keys.begin();
    VecString::const_iterator end = keys.end();
    for ( ; it != end; ++it )
    {
        cmd << *it;
    }

    return ( _getArry( cmd, members ) );
}
开发者ID:nanrenhaiyang,项目名称:redis-client,代码行数:13,代码来源:RedisClientSet.cpp


示例8: hmget

void CRedisClient::hmget(const string &key, const CRedisClient::VecString &fields, CResult &result)
{
    Command cmd( "HMGET" );
    cmd << key;

    VecString::const_iterator it = fields.begin();
    VecString::const_iterator end = fields.end();
    for ( ; it != end; ++it )
    {
        cmd << *it;
    }

    _getArry( cmd , result );
}
开发者ID:RedisCppTeam,项目名称:redis-client,代码行数:14,代码来源:RedisClientHash.cpp


示例9: sunionstroe

uint64_t CRedisClient::sunionstroe(const string &dest, const CRedisClient::VecString &keys)
{
    Command cmd( "SUNIONSTORE" );
    cmd << dest;
    VecString::const_iterator it = keys.begin();
    VecString::const_iterator end = keys.end();
    for ( ; it != end; ++it )
    {
        cmd << *it;
    }
    int64_t num;
    _getInt( cmd, num );
    return num;
}
开发者ID:nanrenhaiyang,项目名称:redis-client,代码行数:14,代码来源:RedisClientSet.cpp


示例10: sinterstore

uint64_t CRedisClient::sinterstore( const string& destKey ,const CRedisClient::VecString &keys )
{
    Command cmd( "SINTERSTORE" );
    cmd << destKey;
    VecString::const_iterator it = keys.begin();
    VecString::const_iterator end = keys.end();
    for ( ; it != end; ++it )
    {
        cmd << *it;
    }

    int64_t num = 0;
    _getInt( cmd, num );
    return num;
}
开发者ID:nanrenhaiyang,项目名称:redis-client,代码行数:15,代码来源:RedisClientSet.cpp


示例11: sadd

uint64_t CRedisClient::sadd(const string &key, const CRedisClient::VecString &members)
{
    Command cmd( "SADD" );
    cmd << key;
    VecString::const_iterator it = members.begin();
    VecString::const_iterator end = members.end();

    for ( ; it != end ; ++it )
    {
        cmd << *it;
    }
    int64_t num;
    _getInt( cmd , num );
    return num;
}
开发者ID:nanrenhaiyang,项目名称:redis-client,代码行数:15,代码来源:RedisClientSet.cpp


示例12: hdel

void CRedisClient::hdel(const string &key, const CRedisClient::VecString &fields, CResult &result )
{
    _socket.clearBuffer();;
    Command cmd( "HDEL" );
    cmd << key;

    VecString::const_iterator it = fields.begin();
    VecString::const_iterator end = fields.begin();
    for ( ; it != end; ++it )
    {
        cmd << *it;
    }

    _sendCommand( cmd );
    _getReply( result );
}
开发者ID:RedisCppTeam,项目名称:RedisCpp-hiredis,代码行数:16,代码来源:RedisClientHash.cpp


示例13: hdel

uint64_t CRedisClient::hdel( const string &key, const CRedisClient::VecString &fields )
{
    Command cmd( "HDEL" );
    cmd << key;

    VecString::const_iterator it = fields.begin();
    VecString::const_iterator end = fields.end();
    for ( ; it != end; ++it )
    {
        cmd << *it;
    }

    int64_t num = 0;
    _getInt( cmd , num );
    return num;
}
开发者ID:RedisCppTeam,项目名称:redis-client,代码行数:16,代码来源:RedisClientHash.cpp


示例14: stringToVecString

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();

}
开发者ID:nanrenhaiyang,项目名称:redis-client,代码行数:17,代码来源:RedisClientServer.cpp


示例15: hvals

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();
}
开发者ID:RedisCppTeam,项目名称:RedisCpp-hiredis,代码行数:21,代码来源:RedisClientHash.cpp


示例16: TestPfadd

void TestPfadd( void )
{
	try
	{
		CRedisClient redis;
		redis.connect("127.0.0.1", 6379);

		CRedisClient::VecString element;
		element.push_back("a");
		element.push_back("b");
		element.push_back("c");
		string key("key1");
		uint64_t count = redis.pfadd(key, element);
		cout << count << endl;
	} catch( RdException& e )
	{
		std::cout << "Redis exception:" << e.what() << std::endl;
	} catch( Poco::Exception& e )
	{
		std::cout << "Poco_exception:" << e.what() << std::endl;
	}
}
开发者ID:RedisCppTeam,项目名称:redis-client,代码行数:22,代码来源:testHyperLogLog.cpp


示例17: TestRpush

void TestRpush( void )
{
	try
	{

		CRedisClient redis;
		redis.connect("127.0.0.1", 6379);
		string mykey = "key";

		CRedisClient::VecString value;
		value.push_back("e");
		value.push_back("g");
		value.push_back("j");
		int count = redis.rpush(mykey, value);
		std::cout << count << std::endl;
	} catch( RdException& e )
	{
		std::cout << "Redis exception:" << e.what() << std::endl;
	} catch( Poco::Exception& e )
	{
		std::cout << "Poco_exception:" << e.what() << std::endl;
	}
}
开发者ID:nanrenhaiyang,项目名称:redis-client,代码行数:23,代码来源:testList.cpp


示例18: hkeys

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();
}
开发者ID:RedisCppTeam,项目名称:RedisCpp-hiredis,代码行数:17,代码来源:RedisClientHash.cpp


示例19: TestBrpop

void TestBrpop( void )
{
	try
	{
		CRedisClient redis;
		redis.setTimeout(0,0);
		redis.connect("127.0.0.1", 6379);

		string key = "key";
		string key2 = "key2";
		CRedisClient::VecString keyValue;
		keyValue.push_back("a");
		keyValue.push_back("b");
		keyValue.push_back("c");
		CRedisClient::VecString key2Value;
		key2Value.push_back("1");
		key2Value.push_back("2");
		key2Value.push_back("3");

        redis.rpush(key, keyValue);
        redis.rpush(key2, key2Value);

		CRedisClient::VecString keys;
		keys.push_back("key");
		keys.push_back("key2");

		CRedisClient::MapString value;
		uint64_t timeout = 3;
        if ( !redis.brpop(keys, timeout, value) )
        {
            std::cout << "brpop falied" << std::endl;
            return;
        }

		CRedisClient::MapString::const_iterator it = value.begin();
		CRedisClient::MapString::const_iterator end = value.end();
		while ( it != end )
		{
			cout << it->first << endl;
			cout << it->second << endl;
			++it;
		}
	} catch( RdException& e )
	{
		std::cout << "Redis exception:" << e.what() << std::endl;
	} catch( Poco::Exception& e )
	{
		std::cout << "Poco_exception:" << e.what() << std::endl;
	}
}
开发者ID:RedisCppTeam,项目名称:redis-client,代码行数:50,代码来源:testList.cpp


示例20: TestSet

///////////////////////////////////////////// test set //////////////////////////////////////////
void TestSet( void )
{
    try
    {
        CRedisClient redis;
        redis.connect( "127.0.0.1", 6379 );

        //--------------------------test sadd-------------------------------
        CRedisClient::VecString members;
        members.push_back( "yuhaiyang" );
        members.push_back( "zhouli" );
        members.push_back( "严兴俊" );
        uint64_t saddNum = redis.sadd( "testSet", members );
        std::cout << "saddNum: " << saddNum << std::endl;
        //-------------------------test scard--------------------------------
        uint64_t scardNum = redis.scard( "testSet" );
        std::cout << "scardNum:" << scardNum << std::endl;
        //-------------------------test sdiff----------------------------------
        std::cout << "=====================================sdiffData==========================" << std::endl;
        CRedisClient::VecString keys;
        keys.push_back("testSet");
        keys.push_back("testSet2");
        CRedisClient::VecString sdiffValues;
        uint64_t sdiffNum = redis.sdiff( keys, sdiffValues );
        std::cout << "sdiffNum: " << sdiffNum << std::endl;

        //-------------------------test sdiffstore----------------------------
        CRedisClient::VecString sdiffstorekeys;
        sdiffstorekeys.push_back("testSet");
        sdiffstorekeys.push_back("testSet2");
        uint64_t sdiffstoreNum = redis.sdiffstore( "diffSetKey",sdiffstorekeys );
        std::cout << "===========================sdiffNum=================================" << std::endl;
        std::cout << "sdiffstoreNum: " << sdiffstoreNum << std::endl;
        //---------------------------test sinter--------------------------------
        CRedisClient::VecString sinterValues;
        CRedisClient::VecString sinterKeys;
        sinterKeys.push_back( "testSet" );
        sinterKeys.push_back( "testSet2" );
        uint64_t sinterNum = redis.sinter( sinterKeys, sinterValues );
        std::cout << "===========================sinterNum================================" << std::endl;
        std::cout << "sinterNum: " << sinterNum << std::endl;
        CRedisClient::VecString::const_iterator sinterIt = sinterValues.begin();
        CRedisClient::VecString::const_iterator sinterEnd = sinterValues.end();
        for ( ; sinterIt != sinterEnd; ++sinterIt )
        {
            std::cout << "sinterIt: " << *sinterIt << std::endl;
        }
        //-----------------------------test sinterstore---------------------------
        CRedisClient::VecString sinterstoreKeys;
        sinterstoreKeys.push_back( "testSet" );
        sinterstoreKeys.push_back( "testSet2" );
        uint64_t sinterstoreNum = redis.sinterstore( "interSetKey", sinterstoreKeys );
        std::cout << "sinterstoreNum: " << sinterstoreNum << std::endl;
        //----------------------------test sismember----------------------------
        bool ret = redis.sismember( "testSet", "yuhaiyang2" );
        if ( ret )
        {
            std::cout << "存在" << std::endl;
        }else
        {
            std::cout << "不存在" << std::endl;
        }

        CRedisClient::VecString membersMembers;
        uint64_t smembersNum = redis.smembers( "testSet", membersMembers );
        std::cout << "smembersNum" << smembersNum << std::endl;
        PrintVector( "members", membersMembers );

        //-----------------------------test smove-------------------------------------
        bool smoveRet = redis.smove( "testSet2", "testSet","duzong");
        if ( smoveRet )
        {
            std::cout << "smove ok" << std::endl;
        }else
        {
            std::cout << "smove failed" << std::endl;
        }

        //-----------------------------test spop--------------------------------------
        string spopMember;
        bool spopRet = redis.spop( "testSet3", spopMember );
        if ( spopRet )
        {
            std::cout << "spop ok" << std::endl;
            std::cout << "spop data:" << spopMember << std::endl;
        }else
        {
            std::cout << "spop faliled" << std::endl;
        }

        //-----------------------------test srandmember-----------------------------
        string srandmember;
        bool srandRet = redis.srandmember( "testSet3", srandmember );
        if ( srandRet )
        {
            std::cout << "srandmember ok" <<std::endl;
            std::cout << "srandmember data:" << srandmember << std::endl;
        }else
        {
//.........这里部分代码省略.........
开发者ID:nanrenhaiyang,项目名称:redis-client,代码行数:101,代码来源:testSet.cpp



注:本文中的credisclient::VecString类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ creg::ISerializer类代码示例发布时间:2022-05-31
下一篇:
C++ creaturemaptype::iterator类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap