MCPcopy Create free account
hub / github.com/alibaba/PhotonLibOS / redis_cpp_official

Function redis_cpp_official

examples/integration/redis.cpp:91–112  ·  view source on GitHub ↗

this function is copied from the official site of redis_cpp

Source from the content-addressed store, hash-verified

89
90// this function is copied from the official site of redis_cpp
91int 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
115void demo_cpp_redis() {

Callers 1

demo_redis_cppFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected