void TestLindex( void ) { try { CRedisClient redis; redis.connect("127.0.0.1", 6379); string mykey = "testList"; std::string value; if ( !redis.lindex(mykey, 3, value) ) { std::cout << "lindex failed!!" << std::endl; }else { std::cout << value << 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; } }
void TestLindex( void ) { try { CRedisClient redis; redis.connect("127.0.0.1", 6379); string mykey = "key"; std::string value; bool flag = redis.lindex(mykey, 2, value); std::cout << flag << std::endl; std::cout << value << 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; } }