Last active
December 17, 2018 18:45
-
-
Save ChrisCates/1b1ab68cdb16d4406d77226a7917d474 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Add this header after including the hiredis and hiredisx libraries in your build. | |
| #include "hiredisx.hpp" | |
| // Make sure you can connect to the redis instance. | |
| bool validConnection = hiredisx::test::connect(); | |
| if (validConnection) { | |
| std::string ping = hiredisx::ping(); // PONG if valid. | |
| bool set = hiredisx::set("foo", "bar"); // True if set | |
| std::string foo = hiredisx::get("foo"); // "bar" if correct | |
| bool deleted = hiredisx::del("foo"); // True if deleted | |
| bool pushed = hiredisx::push("list", "yo", "R"); // True if pushed to list. Note that "R" means Right append, "L" means Left append. | |
| std::vector<std::string> list = hiredisx::list("list", 0, -1, "L"); // 0 is the start of the list, -1 means the end of the list (you can specify a specific length, 10 being first 10 elements for examples). | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment