halybang / hirediscpp Goto Github PK
View Code? Open in Web Editor NEWThis project forked from petrohi/hiredispp
C++ wrapper for hiredis C library - Remove boost - Using C++11
License: Boost Software License 1.0
This project forked from petrohi/hiredispp
C++ wrapper for hiredis C library - Remove boost - Using C++11
License: Boost Software License 1.0
Hirediscpp is forked from Hiredispp with some changed: * Work with C++11 * Remove all boost requirement * Modify code to work with libevent * I don't like exception, so I commented out some exception * Add .pri and .pro file for easy to add to QT project * Modify example to work with libevent Just open hirediscpp.pro with Qt Creator then enjoy ! Introduction ------------ Hiredispp is a C++ wrapper around hiredis C library. Hiredis is powerful yet low level client interface for Redis server. Hiredispp aims at providing Redis client interface for standard C++ by leveraging hiredis implementation. Connection ---------- Connection to Redis server is represented by hiredispp::Redis class with type safe implementations of Redis commands hiredispp::Redis r("localhost"); r.set("foo", "bar"); std::string s = r.get("foo"); boost::int64_t i = r.incr("counter"); Reply ----- Multi-bulk Redis reply is represented by hiredispp::Redis::Reply type hiredispp::Redis::Reply reply = r.keys("foo:*"); std::vector<std::string> keys; reply.toVector(keys); Dynamic Commands ---------------- It is possible to issue dynamically created commands with hiredispp::Redis::Command class std::vector<std::string> keys; hiredispp::Redis::Command sunionstore("SUNIONSTORE"); sunionstore << "result" << keys; r.execute(sunionstore); Pipelining ---------- Redis pipelining is enabled by pair of begin/end calls in hiredispp::Redis for (...) { r.beginSadd(key, member); } for (...) { boost::int64_t c = r.endCommand();ng } Also it possible to pipeline dynamic commands by executing vector of hiredispp::Redis::Command objects std::vector<hiredispp::Redis::Command> commands; for (...) { commands.push_back(hiredispp::Redis::Command("SADD") << key << member); } std::vector<hiredispp::Redis::Reply> replies; r.execute(commands, replies); Exceptions ---------- All hiredis library error conditions are thrown as hiredispp::RedisException try { r.ping(); } catch (const hiredispp::RedisException& e) { cerr << e.what(); } After disconnection it is possible to reuse existing hiredispp::Redis object, it will attempt to restore connection. UNICODE support --------------- hiredispp::Redis has corresponding hiredispp::wRedis template instance that supports std::wstring. UNICODE strings are UTF-8 encoded for Redis.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.