当前位置: 首页>>代码示例>>C++>>正文


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

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


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


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