Ejemplo n.º 1
0
void TestPing( void )
{
	try
	{
		CRedisClient redis;
		redis.connect("127.0.0.1", 6379);

		string value;
		bool flag = redis.ping(value);
		cout << flag << endl;
		cout << value << endl;
	} catch( RdException& e )
	{
		std::cout << "Redis exception:" << e.what() << std::endl;
	} catch( Poco::Exception& e )
	{
		std::cout << "Poco_exception:" << e.what() << std::endl;
	}
}
Ejemplo n.º 2
0
void TestSmonitor(){
    CRedisClient redis;
    redis.connect( "127.0.0.1", 6379 );

    pthread_t tid;
    pthread_create( &tid,NULL,MonitorStop,(void*)&redis );

    cout << "------test monitor-----" << endl;
    string str;
    redis.monitorStart();
   while(redis.monitorRead(str,0))
        TestServerPrint("redis.monitorRead()",str);


   redis.reconnect();
   std::cout << "reconnect!!!!" << std::endl;
   string value;
   redis.ping( value );
   std::cout << "ping: " <<  value << std::endl;
}