this function is copied from the official site of redis_cpp
| 89 | |
| 90 | // this function is copied from the official site of redis_cpp |
| 91 | int redis_cpp_official(std::iostream* stream) { |
| 92 | try |
| 93 | { |
| 94 | // auto stream = rediscpp::make_stream("localhost", "6379"); |
| 95 | |
| 96 | auto const key = "my_key"; |
| 97 | |
| 98 | auto response = rediscpp::execute(*stream, "set", |
| 99 | key, "Some value for 'my_key'", "ex", "60"); |
| 100 | |
| 101 | std::cout << "Set key '" << key << "': " << response.as<std::string>() << std::endl; |
| 102 | |
| 103 | response = rediscpp::execute(*stream, "get", key); |
| 104 | std::cout << "Get key '" << key << "': " << response.as<std::string>() << std::endl; |
| 105 | } |
| 106 | catch (std::exception const &e) |
| 107 | { |
| 108 | std::cerr << "Error: " << e.what() << std::endl; |
| 109 | return EXIT_FAILURE; |
| 110 | } |
| 111 | return EXIT_SUCCESS; |
| 112 | } |
| 113 | |
| 114 | // this function demostrates how to integrate photon with cpp_redis |
| 115 | void demo_cpp_redis() { |