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; } }
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; } }