What would be the best way to use a Redis DB within a C++ program?
相关问题
- Sorting 3 numbers without branching [closed]
- How to compile C++ code in GDB?
- Why does const allow implicit conversion of refere
- thread_local variables initialization
- What uses more memory in c++? An 2 ints or 2 funct
I wrote a C++ Redis client: redis-plus-plus. It's based on hiredis, and written in C++11. It supports the following features:
It's very fast, and easy to use:
Check the doc for details.
Official list of C++ clients
Explore a full list of Redis C++ clients on redis.io. You will find there different clients based on boost, Qt, etc. Note that at this time none of the C++ client implementations are marked as "Recommended." But there is a recommended C client, hiredis, which should work just fine in C++.
https://github.com/petrohi/hiredispp
Also check out hiredispp. It is far from complete, but very simplistic implementation that wraps around C based hiredis. Hiredis takes care of low level protocol and networking stuff while hiredispp wrappers just make it C++ friendly.
Using a C bindings library? There doesn't seem to be a C++ wrapper available anywhere.
I have forked the fictorial redis-cplusplus-client, made it compatible to redis-server v2.0, added missing api calls and implemented consistent hashing. There is also an early state of high level classes that will be useable like stl types in the near future (shared_string, shared_int, shared_set, ...). Nothing is production ready yet but the provided tests are succesfully running :-)
http://github.com/mrpi/redis-cplusplus-client
https://github.com/brianwatling/redispp
I've just released my c++ redis client on github. It's main feature right now is pipelining, I'll be adding more features soon, possibly sharding/consistent hashing next.