C++11 Lightweight Redis client: async, thread-safe, no dependency, pipelining, multi-platform

Overview

Important

Please be advised that this library is no longer maintained.

For new updates, please refer to the following fork https://github.com/cpp-redis/cpp_redis

I have maintained this library for over 3 years, but I do not have enough time to provide a reliable support and continuous development for any longer.

Any existing or new issues will not be treated and I do not guarantee to merge any new pull request.

If anyone is willing to take over this project, feel free to fork this project and message me to add a link to your fork in this README.

cpp_redis Build Status Build status

cpp_redis is a C++11 Asynchronous Multi-Platform Lightweight Redis Client, with support for synchronous operations, pipelining, sentinels and high availability.

Requirement

cpp_redis has no dependency. Its only requirement is C++11.

It comes with no network module, so you are free to configure your own, or to use the default one (tacopie)

Example

cpp_redis::client

get_reply = client.get("hello"); client.sync_commit(); //! or client.commit(); for asynchronous call ">
cpp_redis::client client;

client.connect();

client.set("hello", "42");
client.get("hello", [](cpp_redis::reply& reply) {
  std::cout << reply << std::endl;
});
//! also support std::future
//! std::future
   
     get_reply = client.get("hello");
   

client.sync_commit();
//! or client.commit(); for asynchronous call

cpp_redis::client full documentation and detailed example. More about cpp_redis::reply.

cpp_redis::subscriber

cpp_redis::subscriber sub;

sub.connect();

sub.subscribe("some_chan", [](const std::string& chan, const std::string& msg) {
  std::cout << "MESSAGE " << chan << ": " << msg << std::endl;
});
sub.psubscribe("*", [](const std::string& chan, const std::string& msg) {
  std::cout << "PMESSAGE " << chan << ": " << msg << std::endl;
});

sub.commit();

cpp_redis::subscriber full documentation and detailed example.

Wiki

A Wiki is available and provides full documentation for the library as well as installation explanations.

Doxygen

A Doxygen documentation is available and provides full API documentation for the library.

License

cpp_redis is under MIT License.

Contributing

Please refer to CONTRIBUTING.md.

Special Thanks

Mike Moening for his unexpected and incredible great work aiming to port cpp_redis on Windows, provides sentinel support and high availability support!

Author

Simon Ninon

Comments
  • linux write data 100% cpu

    linux write data 100% cpu

    Thread 4 (Thread 0x7f6ca5eaa700 (LWP 910)): #0 0x00007f6cacedc933 in select () from /lib64/libc.so.6 #1 0x00000000004ad6fa in tacopie::io_service::poll() () #2 0x00007f6cad77d230 in ?? () from /lib64/libstdc++.so.6 #3 0x00007f6cacbdadf3 in start_thread () from /lib64/libpthread.so.0 #4 0x00007f6cacee51ad in clone () from /lib64/libc.so.6

    Threads: 2344 total, 3 running, 2341 sleeping, 0 stopped, 0 zombie %Cpu(s): 21.0 us, 32.5 sy, 0.0 ni, 46.3 id, 0.0 wa, 0.0 hi, 0.2 si, 0.0 st KiB Mem: 16269700 total, 15801636 used, 468064 free, 158872 buffers KiB Swap: 0 total, 0 used, 0 free. 2272844 cached Mem

    PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
    910 root 20 0 416432 1336 980 R 99.8 0.0 46:30.66 PlayBackServer

    possibly fixed 
    opened by xFurther 28
  • Some issues concerning the network module

    Some issues concerning the network module

    Some issues are reported concerning the network part. (#19 #21 #24 #25) One is concerning the unix version, the other are mostly concerning the windows port.

    I am currently working on an external library providing networking TCP features in a much-enhanced design.

    This external library is intended to replace the networking module of cpp_redis and this should fix these issues.

    opened by Cylix 17
  • After fork redis doesn't work in the child process

    After fork redis doesn't work in the child process

    Hi Cylix,

    Before I get to the issue, I would like to thank you for the great library and your continued support and addition of new features!

    I was sad to see the dropped support for the sync client, since it was the main reason I started using the library, but I've managed to make it work with a copy of the old code and some additions of sync_commit to the commands, but this isn't the problem. I had to update the library because we needed Sentinel support and your update was as if timed with our new requirement :D.

    With the previous and new version I've tried to establish a redis connection after a fork, but it doesn't seem to work if there was a previous redis connection (even if terminated). For simplicity's sake and to get an idea of what I'm doing, this is the code I'm testing (the final version of it, because I've tried other things as well, which don't seem to work either), but since it uses the sync client you won't be able to compile it:

    	cpp_redis::sync_client* redis = new cpp_redis::sync_client();
    
    	redis->connect("127.0.0.1", 6379);
    	redis->select(0);
    
    	cout << redis->is_connected() << " get " << redis->get("test") << endl;
    	redis->disconnect(true);
    
    	delete redis;
    
    	pid_t pid = fork();
    
    	redis = new cpp_redis::sync_client();
    
    	cout << pid << endl;
    
    	cout << pid << " is_connected " << redis->is_connected() << endl;
    	//cout << pid << " " << redis.get("test") << endl;
    
    	//cout << pid << " disconnect" << endl;
    	//redis.disconnect();
    	cout << pid << " connect" << endl;
    	redis->connect("127.0.0.1", 6379);
    	cout << pid << " is_connected " << redis->is_connected() << endl;
    	cout << pid << " select" << endl;
    	redis->select(0);
    	cout << pid << " after select" << endl;
    
    	cout << pid << " is_connected " << redis->is_connected() << endl;
    	cout << pid << " get " << redis->get("test") << endl;
    
    	if (pid != 0)
    		wait(pid);
    

    The "test" key has been already pre-set in redis and I've tried lots of different configurations without pointers and disconnection and whatnot. I thought that it had to do something with destroying the instance, but it doesn't seem to work as well. The output I'm getting is: for the parent all commands are executed, but for the child the last thing printed is the " select" statement, which means that it hangs on the line redis->select(0);. Just to note, if no redis instance is present before the fork, the child is able to establish a connection, but it seems like something in the fork is bugging the library (reconnection and destruction don't help). While for now this was sort of ok, most of the time we need the parent to be able to have a redis connection prior to the fork and it doesn't work in any of the ways I've tried.

    I would be grateful if you can look into this, since fork-ing is a rather common thing to do in multiprocess applications and to be quite frank I'm surprised that no one has reported this issue (which in the beginning led me to think that the problem was in my usage of the library, but I don't have many options left now :D ).

    The ideal case would be to have an active redis connection in the parent and after fork-ing to reconnect only the child so that it has its own handler and the parent doesn't need to disconnect and connect again.

    Best Regards, Alex

    bug unix windows 
    opened by Alejandro131 12
  • Redis subscriber connect on disconnect handler doesn't work (or at least wouldn't handle the current subscribed callbacks)

    Redis subscriber connect on disconnect handler doesn't work (or at least wouldn't handle the current subscribed callbacks)

    Hi,

    I am heavily dependent on the redis subscriber and recently while listening to a publish from python script my redis subscriber gets disconnected and the re-connection (from the logs) seems going fine but I stop receiving any callbacks from the subscriber. I tried applying the changes from #73 but still it doesn't work. Please help.

    Thanks, Siril.

    opened by sirilvk 11
  • subscriber does not work on windows

    subscriber does not work on windows

    Hey, Thanks for creating this project. I think its sorely needed and very well made.

    I find that the Subscriber is not working on windows. I just copied your redis_subscriber.cpp example into the TEST project on windows

    • loaded #pragma comment(lib,"WS2_32") and ran it.

    It connects to redis makes a subscription - and shows as subscribed on redis. But the subscription callback is not called. Once in a while a single message might make it through - but never more than that. something seems to be wrong here.

    Please take a look. thanks,

    opened by vivekvrao 11
  • Error

    Error "undefined reference to" Linking Program

    I'm trying to compile two days, but I always get linking errors, I'm trying to compile a module with godot (a game engine), I'm not sure where the error may be, but I've never had problems linking libraries when compiling modules on godot. The error is this:

    [ 97%] Linking Program        ==> bin/godot.x11.tools.64
    modules/libmodules.x11.tools.64.a(gdredis.x11.tools.64.o): In function `GDRedis::GDRedis()':
    /home/noloop/godot-3.0-20out2017/modules/gdredis/gdredis.cpp:5: undefined reference to `cpp_redis::client::client()'
    modules/libmodules.x11.tools.64.a(gdredis.x11.tools.64.o): In function `GDRedis::~GDRedis()':
    /home/noloop/godot-3.0-20out2017/modules/gdredis/gdredis.h:17: undefined reference to `cpp_redis::client::~client()'
    collect2: error: ld returned 1 exit status
    scons: *** [bin/godot.x11.tools.64] Error 1
    scons: building terminated because of errors.
    

    I do not understand why it tells me this "In function `GDRedis::~GDRedis()':" being that neither destructor has in my code. I've tried everything I imagined it could be, and I have no idea what to try.

    What can you tell me when you speak"undefined reference to"?

    wait for reporter response 
    opened by perdugames 10
  • Add Visual C++ Build Config

    Add Visual C++ Build Config

    Hi Simon @Cylix, thanks for the effort you put in this project.

    The tool chain of my current project requires a MS Visual C++ compiler. I added project and solution files for MS Visual Studio 2017 for the current version:

    • Visual Studio version 15 (a.k.a. 2017)
    • VC++ tools version 15.0
    • Platform tool set v141

    The project file assumes, that tacopie is checked out and compiled in directory cpp_redis/tacopie.

    Are you interested in merging this into your work?

    Any comments are welcome.


    Before submitting the pull request, ensure that:

    • [x] your feature works as expected and is tested
    • [x] all tests pass on both your computer and the Travis
    • [N/A] you have used the formatting tool
    opened by zodiac403 10
  • Disconnect issue

    Disconnect issue

    There is a disconnect issue in the examples that puzzles me. The sigint_handler and the subsequent disconnection handler are invoked upon sending the interrupt signal, but the main function does not terminate.

    Adding a sleep(1) inside the "while (not should_exit);" loop appears to solve the termination issue, but is there possibly a disconnect/threading issue at play here?

    Thank you for a nice Redis client!

    opened by tobbe303 8
  • Compiling examples

    Compiling examples

    Unfortunately I get always errors while compiling your samples. Could you perhaps provide an example in short shell commands for linux (tried it on Ubuntu LTS).

    Regards,

    Tilman

    opened by tilmanotto 7
  • Link Error in Visual Studio 2015

    Link Error in Visual Studio 2015

    The cpp_redis build is fine in both Debug/Release mode. And I copied the cpp_redis.lib and tacopie.lib to my project folder and referred them in the project setting. I got some link errors when trying to build:

    1>tacopie.lib(tcp_socket.obj) : error LNK2019: unresolved external symbol __imp_accept referenced in function "public: class tacopie::tcp_socket __cdecl tacopie::tcp_socket::accept(void)" (?accept@tcp_socket@tacopie@@QEAA?AV12@XZ) 1>tacopie.lib(tcp_socket.obj) : error LNK2019: unresolved external symbol __imp_bind referenced in function "public: void __cdecl tacopie::tcp_socket::bind(class std::basic_string<char,struct std::char_traits,class std::allocator > const &,unsigned int)" (?bind@tcp_socket@tacopie@@QEAAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@I@Z) 1>tacopie.lib(self_pipe.obj) : error LNK2001: unresolved external symbol __imp_bind 1>tacopie.lib(tcp_socket.obj) : error LNK2019: unresolved external symbol __imp_closesocket referenced in function "public: void __cdecl tacopie::tcp_socket::close(void)" (?close@tcp_socket@tacopie@@QEAAXXZ) 1>tacopie.lib(self_pipe.obj) : error LNK2001: unresolved external symbol __imp_closesocket 1>tacopie.lib(tcp_socket.obj) : error LNK2019: unresolved external symbol __imp_connect referenced in function "public: void __cdecl tacopie::tcp_socket::connect(class std::basic_string<char,struct std::char_traits,class std::allocator > const &,unsigned int)" (?connect@tcp_socket@tacopie@@QEAAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@I@Z) 1>tacopie.lib(self_pipe.obj) : error LNK2001: unresolved external symbol __imp_connect 1>tacopie.lib(tcp_socket.obj) : error LNK2019: unresolved external symbol __imp_htons referenced in function "public: void __cdecl tacopie::tcp_socket::connect(class std::basic_string<char,struct std::char_traits,class std::allocator > const &,unsigned int)" (?connect@tcp_socket@tacopie@@QEAAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@I@Z) 1>tacopie.lib(tcp_socket.obj) : error LNK2019: unresolved external symbol __imp_listen referenced in function "public: void __cdecl tacopie::tcp_socket::listen(unsigned __int64)" (?listen@tcp_socket@tacopie@@QEAAX_K@Z) 1>tacopie.lib(tcp_socket.obj) : error LNK2019: unresolved external symbol __imp_recv referenced in function "public: class std::vector<char,class std::allocator > __cdecl tacopie::tcp_socket::recv(unsigned __int64)" (?recv@tcp_socket@tacopie@@QEAA?AV?$vector@DV?$allocator@D@std@@@std@@_K@Z) 1>tacopie.lib(tcp_socket.obj) : error LNK2019: unresolved external symbol __imp_send referenced in function "public: unsigned __int64 __cdecl tacopie::tcp_socket::send(class std::vector<char,class std::allocator > const &,unsigned __int64)" (?send@tcp_socket@tacopie@@QEAA_KAEBV?$vector@DV?$allocator@D@std@@@std@@_K@Z) 1>tacopie.lib(tcp_socket.obj) : error LNK2019: unresolved external symbol __imp_socket referenced in function "private: void __cdecl tacopie::tcp_socket::create_socket_if_necessary(void)" (?create_socket_if_necessary@tcp_socket@tacopie@@AEAAXXZ) 1>tacopie.lib(self_pipe.obj) : error LNK2001: unresolved external symbol __imp_socket 1>tacopie.lib(tcp_socket.obj) : error LNK2019: unresolved external symbol __imp_getaddrinfo referenced in function "public: void __cdecl tacopie::tcp_socket::connect(class std::basic_string<char,struct std::char_traits,class std::allocator > const &,unsigned int)" (?connect@tcp_socket@tacopie@@QEAAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@I@Z) 1>tacopie.lib(tcp_socket.obj) : error LNK2019: unresolved external symbol __imp_freeaddrinfo referenced in function "public: void __cdecl tacopie::tcp_socket::connect(class std::basic_string<char,struct std::char_traits,class std::allocator > const &,unsigned int)" (?connect@tcp_socket@tacopie@@QEAAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@I@Z) 1>tacopie.lib(io_service.obj) : error LNK2019: unresolved external symbol __imp_WSAPoll referenced in function "private: void __cdecl tacopie::io_service::poll(void)" (?poll@io_service@tacopie@@AEAAXXZ) 1>tacopie.lib(self_pipe.obj) : error LNK2019: unresolved external symbol __imp_ioctlsocket referenced in function "public: __cdecl tacopie::self_pipe::self_pipe(void)" (??0self_pipe@tacopie@@QEAA@XZ) 1>tacopie.lib(self_pipe.obj) : error LNK2019: unresolved external symbol __imp_getsockname referenced in function "public: __cdecl tacopie::self_pipe::self_pipe(void)" (??0self_pipe@tacopie@@QEAA@XZ) 1>tacopie.lib(self_pipe.obj) : error LNK2019: unresolved external symbol __imp_htonl referenced in function "public: __cdecl tacopie::self_pipe::self_pipe(void)" (??0self_pipe@tacopie@@QEAA@XZ) 1>tacopie.lib(self_pipe.obj) : error LNK2019: unresolved external symbol __imp_recvfrom referenced in function "public: void __cdecl tacopie::self_pipe::clr_buffer(void)" (?clr_buffer@self_pipe@tacopie@@QEAAXXZ) 1>tacopie.lib(self_pipe.obj) : error LNK2019: unresolved external symbol __imp_sendto referenced in function "public: void __cdecl tacopie::self_pipe::notify(void)" (?notify@self_pipe@tacopie@@QEAAXXZ)

    Are there any dependencies required for building? I am using Visual Studio 2015.

    windows possibly fixed 
    opened by ZuroonNotice 7
  • Hang on sync_commit()

    Hang on sync_commit()

    We have a sync_commit call that works fine most of the time, but on occasion it seems to hang on the following line:

    m_sync_condvar.wait(lock_callback, [=] { return m_callbacks_running == 0 && m_callbacks.empty(); });

    m_callbacks_running is 0 and m_callbacks is empty, but it looks like the condition variable is not being notified? It just waits forever and nothing makes progress. I'm not really sure how to debug this!

    opened by aardvarkk 7
  • Publish causes exception in tacopie

    Publish causes exception in tacopie

    Hi there,

    I really like the platform and thank you for continuing to maintain a great project.

    I have a query though regarding Publishing as it may be broken in the latest build. Although I can subscribe to a channel fine no messages are actually received.. But I noticed that the debug window was showing an exception thrown by tacopie and a memory address. I can't locate the problem however.

    I am using Redis 4.0.

    Any suggestions please?

    Thanks

    opened by lefig 1
  • blpop command still block program after timeout

    blpop command still block program after timeout

    I try to use blpop with timeout parameter as the following code:

    int main(int argc, char* argv[]) {
      cpp_redis::client client;
      RedisInfo redis_info;
      redis_info.address = "127.0.0.1";
      redis_info.port = 6379;
    
      // This function is just init a redis client.
      if (!common::InitRedisClient(&client, redis_info)) {
        cout << "Establish connection to redis failed" << endl;
        return 0;
      } else {
        cout << "Establish connection to redis succeed" << endl;
      }
    
      vector<string> keys;
      keys.push_back("test");
      client.blpop(keys, 1, [](cpp_redis::reply& reply) {
        cout << "Blpop response: " << reply.as_string() << endl;
      });
      client.sync_commit();
    
      cout << "Blpop timeout" << endl;
    
      return 0;
    }
    

    As my understanding, program should print "Blpop timeout" after 1s and there are no data push to test list. But program seem to be block and never end. Is this expected behavior of blpop command with timeout?

    opened by larvavral 0
  • Fedora Localhost works but on remote  hangs

    Fedora Localhost works but on remote hangs

    When I run redis with localhost read/write works perfectly but with remote redis client hangs randomly. The stack trace points to conditonal wait on the mutex. I am yet to derive any conclusion but seems with small string it works fine but with big value 1mb trouble starts.. It just hangs ( wait)!
    Any pointer would be real help!!

    opened by rahulbksc 0
  • segmentation fault on exit when auto-reconnect is true

    segmentation fault on exit when auto-reconnect is true

    Below redis client program seg-faults on exit if redis-server is not available. I killed redis-server after the client started. Call stack from core dump is below.

    #include <cpp_redis/cpp_redis>
    #include <thread>
    #include <chrono>
    
    int main(void) 
    {
      cpp_redis::client client;
      client.connect("127.0.0.1", 6379, nullptr, 0, 10, 1000);
      std::this_thread::sleep_for(std::chrono::seconds(5)); // kill redis-server during this sleep
      client.cancel_reconnect();
      return 0;
    }
    
    

    (gdb) bt #0 0x00007f6f7b23db63 in std::__cxx11::basic_string<char, std::char_traits, std::allocator >::_M_replace(unsigned long, unsigned long, char const*, unsigned long) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6 #1 0x00000000004b2c78 in cpp_redis::sentinel::get_master_addr_by_name(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, std::__cxx11::basic_string<char, std::char_traits, std::allocator >&, unsigned long&, bool) () #2 0x00000000004279f7 in cpp_redis::client::reconnect() () #3 0x00000000004268df in cpp_redis::client::connection_disconnection_handler(cpp_redis::network::redis_connection&) () #4 0x00000000004be0ab in tacopie::tcp_client::on_read_available(int) () #5 0x00000000004bc9cd in std::_Function_handler<void (), tacopie::io_service::process_rd_event(int const&, tacopie::io_service::tracked_socket&)::$_0>::_M_invoke(std::_Any_data const&) () #6 0x00000000004c1561 in tacopie::utils::thread_pool::run() () #7 0x00007f6f7b1d2733 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6 #8 0x00007f6f7b4a96db in start_thread (arg=0x7f6f7a76c700) at pthread_create.c:463 #9 0x00007f6f7a88e88f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

    opened by kiranpradeep 0
  • Suggest better approach for connect and reconnect(when disconnected by server).

    Suggest better approach for connect and reconnect(when disconnected by server).

    Bear minimum code

    Connect and reconnect code

    `void RedisUtil::connect_callback(const std::string& host, std::size_t port, cpp_redis::client::connect_state status){ if (status == cpp_redis::client::connect_state::dropped) { std::unique_lockstd::mutex ulock(m_mutex); m_con_var.wait(ulock,std::bind(&RedisUtil::is_client_available,this)); release(); while(intialize(host,port)){}; } }

    bool RedisUtil::intialize(const std::string &redis_host , const int redis_port ){ auto conn_call_wrap = std::bind( &RedisUtil::connect_callback,this,_1,_2,_3); redis_client.connect(redis_host, redis_port,conn_call_wrap); }`

    Redis client get wrapper

               `std::lock_guard<std::mutex> guard(m_mutex);
    	m_is_cli_avail = false;
    	redis_client.get(key, getCallBack);
    	redis_client.sync_commit();
    	m_is_cli_avail = true;
    	m_con_var.notify_one();`
    

    I am looking for a better approach, any help will be gratefully welcome.

    opened by ashishsb95 0
Releases(4.3.1)
  • 4.3.1(Feb 1, 2018)

    Tag

    4.3.1.

    Date

    January 31st, 2018

    Changes

    • Fix compilation issues on some platforms
    • Fix CMake configuration issues
    • Compile with position independent code
    • Fix issue when reconnecting if the internal buffer was not cleared. Now fully clear all input/output buffers
    • Fix set_nb_workers behavior
    • Bump tacopie: compilation fix, position independent code, set_nb_workers fix

    Additions

    None

    Removals

    None

    Source code(tar.gz)
    Source code(zip)
  • 4.3.0(Nov 14, 2017)

    Tag

    4.3.0.

    Date

    November 13th, 2017

    Changes

    • tacopie: fork support: allow set_default_io_service to take nullptr. In order to safely fork, call set_default_io_service(nullptr) to make sure the io_service destructor is called and all underlying threads joined.
    • tacopie: fix: timeout for connection not working due to invalid param to select, now working
    • tacopie: improvement: make sure socket is in blocking mode before connection (#32) as it differs from one OS to another
    • tacopie: improvement: check for non-blocking connect errors with getsockopt to avoid connect reporting a successful connection followed by a call to disconnection handler (now connect report a failed

    Additions

    • tacopie: ipv6 support (connect, bind and accept operations, on tcp_server and tcp_client)

    Removals

    None

    Source code(tar.gz)
    Source code(zip)
  • 4.2.0(Nov 3, 2017)

    Tag

    4.2.0.

    Date

    November 2nd, 2017

    Changes

    • CMake fix: Remove explicit STATIC in add_library call so dynamic libraries can be built and improve consistency
    • Tacopie bump to 3.1.0 (refer to tacopie changelog for updates)

    Additions

    • Visual Studio C++ solution

    Removals

    None

    Source code(tar.gz)
    Source code(zip)
  • 4.1.0(Sep 26, 2017)

    Tag

    4.1.0.

    Date

    September 26th, 2017

    Changes

    • Fix some compilation issues on windows (on both cpp_redis and tacopie sides)
    • scan command improvement with additional overloads

    Additions

    • sort command
    • hscan command
    • sscan command
    • zscan command
    • zinterstore command
    • zunionstore command
    • zrangebyscore command
    • zrevrangebyscore command
    • zrangebylex command
    • zrevrangebylex command
    • georadius command
    • georadiusbymember command
    • bitfield command

    Removals

    • Private, Protected and Static functions from doxygen documentation
    Source code(tar.gz)
    Source code(zip)
  • 4.0.0(Sep 25, 2017)

    Tag

    4.0.0.

    Date

    September 20th, 2017

    Changes

    • ZADD score param changed from map to multimap to allow multiple elements with same score
    • connection_callback (replacement of disconnection_callback). Called for any steps of connection process (attempt, success, failure, reconnection, drop, ...)

    Additions

    • Sentinel support
    • Automatic reconnection if requested
    • Connection timeout
    • Ability to set number of io workers if you are working with tacopie
    • redis_client renamed into client
    • redis_subscriber renamed into subscriber
    • commands that failed to be sent (client not connected or disconnected) get their callback called with an error reply connection failure. This ensure that now all callbacks are always called
    • if reconnection process is enabled and succeed, failed commands are resent
    • if you send command and commit while client is not connected, it will now dismiss the commands and call their callback with an error, or resend them if reconnection is enabled. This is a change compared to the existing behavior that simply kept the commands in the buffer.
    • doxygen documentation

    Removals

    • future_client: all functions have been merge into the redis_client
    • disconnection_callback: it is now replaced by the connection callback

    This is a major release with lots of breaking changes. It aims to enable high availability configuration as well as improved consistency with an enhanced design.

    If you are upgrading please consider the following breaking changes:

    • redis_client is now client and redis_subscriber is now subscriber
    • future_client has been removed, but it is actually merged into client. Simply switch from future_client to client and you will have the same behavior
    • disconnection_callback has been removed and replaced by a connection_callback. If you are looking for exact same behavior, you will have to check if the state param is equal to dropped.
    • commands callbacks are always called. In case of failure, an error reply is passed in.

    Any other changes should not be breaking changes but you might be interested into the added features.

    Source code(tar.gz)
    Source code(zip)
  • 3.5.4(Aug 25, 2017)

    Tag

    3.5.4.

    Date

    August 24th, 2017

    Changes

    • fix issue #86 by changing some int32_t to int64_t (was causing overflow leading to stuck program on some architecture)
    • improve travis build with caching

    Additions

    • ZADD command
    • CLIENT KILL

    Removals

    None

    Source code(tar.gz)
    Source code(zip)
  • 3.5.3(Jul 2, 2017)

    Tag

    3.5.3.

    Date

    July 2nd, 2017

    Changes

    • bump tacopie to fix #85 - select keep sleeping and does not process incoming read/write events

    Additions

    None

    Removals

    None

    Source code(tar.gz)
    Source code(zip)
  • 3.5.2(Jun 21, 2017)

    Tag

    3.5.2.

    Date

    June 19th, 2017

    Changes

    • Fix TACOPIE_CMAKE_ARGS getting converted to a string instead of a list
    • Fix Issue 76 (CMake install dir)
    • bump tacopie - fixes to address high CPU usage issues.

    Additions

    • Expose wait_for_removal in .disconnect of redis_client redis_subcriber future_client

    Removals

    None

    Source code(tar.gz)
    Source code(zip)
  • 3.5.1(Apr 30, 2017)

    Tag

    3.5.1.

    Date

    April 30th, 2017

    Changes

    • Fix compilations on windows
    • Fix reconnection behavior
    • Do not clear commands/callback buffer on calling commit or sync_commit while client is disconnected.

    Additions

    None

    Removals

    None

    Source code(tar.gz)
    Source code(zip)
  • 3.5.0(Apr 10, 2017)

    Tag

    3.5.0.

    Date

    April 9th, 2017

    Changes

    None

    Additions

    • New feature - Update tacopie ref - Provide support for Unix socket. Simply pass in 0 as the port when building a redis_client, redis_subscriber or future_client. Then, the host will automatically be treated as the path to a Unix socket instead of a real host. - More in #67.

    Removals

    None

    Source code(tar.gz)
    Source code(zip)
  • 3.4.0(Apr 5, 2017)

    Changes

    • Change: update tacopie ref - IO Service is now based on select and not on poll anymore to solve some issues encountered on windows due to the buggy implementation of poll on windows Systems.

    Additions

    None

    Removals

    None

    Source code(tar.gz)
    Source code(zip)
  • 3.3.0(Apr 4, 2017)

    Changes

    • Rename redis_client::before_callback into redis_client::set_callback_runner which is more relevant.
    • Before, future_client automatically called .commit when sending a command, meaning that no pipelining was done for the future_client. This has been changed and the future_client do not call .commit anymore: this is a breaking change and you must call .commit or .sync_commit when you wish the commands to be effectively sent. Please refer to the examples if necessary.

    Additions

    • Add commit and sync_commit methodsto the future_client for pipelining support.
    • documentation for redis_client::before_callback has been added
    • documentation for future_client has been added

    Removals

    None

    Source code(tar.gz)
    Source code(zip)
  • 3.2.1(Mar 22, 2017)

    Changes

    • Fix static initialization order fiasco condition
    • Change __CPP_REDIS_USE_TACOPIE (cmake variable: USE_TACOPIE) into __CPP_REDIS_USE_CUSTOM_TCP_CLIENT (cmake variable: USE_CUSTOM_TCP_CLIENT). Of course, the meaning is now the opposite.

    Additions

    None

    Removals

    None

    Source code(tar.gz)
    Source code(zip)
  • 3.2.0(Mar 20, 2017)

    Changes

    • tacopie is no longer a mandatory dependency, but just provided by default and can be overridden if necessary.

    Additions

    • add a new interface, cpp_redis::network::tcp_client_iface that allows you to use your own tcp_client in place of tacopie.

    Removals

    • The sync_client has been removed as it was a duplicate of redis_client::sync_commit but with a different implementation based on futures. Please use redis_client and call sync_commit instead.
    Source code(tar.gz)
    Source code(zip)
  • 3.1.2(Mar 7, 2017)

    Changes

    • rename the setbit() function into setbit_() in order to avoid conflict with the standard library macro setbit causing compilation error.

    Additions

    • add send() method to the sync_client and future_client.

    Removals

    None

    Source code(tar.gz)
    Source code(zip)
  • 3.1.1(Feb 26, 2017)

    Changes

    • Fix: subscriber callbacks were sometimes not called due to poll not listening to the appropriate events. Mostly impacted windows as referred in #51, but unix version might also be impacted. Fixed by updating the reference tacopie which contains the fix.

    Additions

    None

    Removals

    None

    Source code(tar.gz)
    Source code(zip)
  • 3.1.0(Feb 16, 2017)

    Changes

    • Fix: compilation for specific windows compilers concerning atomic variables
    • Fix: handle correctly array replies with negative size by returning a null reply instead of throwing an invalid format exception
    • Fix: Bump tacopie version to retrieve a fix concerning gethostbyname() thread-safety issue on unix
    • Fix: compilation for programs based on Qt ('slots' conflict)

    Additions

    • Add some overloads for the Z set functions to support floating point values
    • Add an auth method to the subscriber class to allow a subscriber to authenticate on the redis server

    Removals

    None

    Source code(tar.gz)
    Source code(zip)
  • 3.0.0(Jan 29, 2017)

  • 2.2(Oct 15, 2016)

  • 2.1(Jul 25, 2016)

    New features:

    • Pipelining
    • Functions that wrap the redis_client::send() function
    • Patch bugs (aka, provide more stability)
    • Enhancements of the documentation

    This current version breaks client code using the older versions, mostly due to the pipelining implementation. Indeed, commands are not sent until redis_client::commit() is called.

    Source code(tar.gz)
    Source code(zip)
  • 2.0(Jul 22, 2016)

  • 1.0(Jul 10, 2016)

Owner
Simon Ninon
Senior Site Reliability Engineer at PagerDuty
Simon Ninon
A redis module, similar to redis zset, but you can set multiple scores for each member to support multi-dimensional sorting

TairZset: Support multi-score sorting zset Introduction Chinese TairZset is a data structure developed based on the redis module. Compared with the na

Alibaba 60 Dec 1, 2022
redis-cpp is a header-only library in C++17 for Redis (and C++11 backport)

redis-cpp - lightweight C++ client library for Redis redis-cpp is a C++17 library for executing Redis commands with support for pipelines and the publ

null 77 Dec 11, 2022
Minimalistic C client for Redis >= 1.2

This Readme reflects the latest changed in the master branch. See v1.0.0 for the Readme and documentation for the latest release (API/ABI history). HI

Redis 5.5k Jan 5, 2023
Modern, asynchronous, and wicked fast C++11 client for Redis

redox Modern, asynchronous, and wicked fast C++11 client for Redis [] (https://travis-ci.org/hmartiro/redox) Redox is a C++ interface to the Redis key

Hayk Martiros 380 Jan 7, 2023
Redis client written in C++

redis-plus-plus Overview Features Branches Installation Install hiredis Install redis-plus-plus Run Tests (Optional) Use redis-plus-plus In Your Proje

null 1k Dec 27, 2022
Aredis - a clean redis C++ client

aredis a clean redis C++ client redis_conn rc; if (rc.connect("127.0.0.1"/*host*/, 6379/*port*/, nullptr/*password*/, 1/*db*/)) { redis_command cmd;

Evan 26 Dec 10, 2021
A C++ Redis client

redis3m A C++ Redis client, born to bring my experience using Redis and C++ on a opensource library. Main goals Provide a simple and efficient wrapper

Luca Marturana 183 Dec 16, 2022
A PostgreSQL extension providing an async networking interface accessible via SQL using a background worker and curl.

pg_net is a PostgreSQL extension exposing a SQL interface for async networking with a focus on scalability and UX.

Supabase 49 Dec 14, 2022
An SQLite binding for node.js with built-in encryption, focused on simplicity and (async) performance

Description An SQLite (more accurately SQLite3MultipleCiphers) binding for node.js focused on simplicity and (async) performance. When dealing with en

mscdex 14 May 15, 2022
A type safe SQL template library for C++

sqlpp11 A type safe embedded domain specific language for SQL queries and results in C++ Documentation is found in the wiki So what is this about? SQL

Roland Bock 2.1k Dec 30, 2022
StarRocks is a next-gen sub-second MPP database for full analysis senarios, including multi-dimensional analytics, real-time analytics and ad-hoc query, formerly known as DorisDB.

StarRocks is a next-gen sub-second MPP database for full analysis senarios, including multi-dimensional analytics, real-time analytics and ad-hoc query, formerly known as DorisDB.

StarRocks 3.7k Dec 30, 2022
A lightweight header-only C++11 library for quick and easy SQL querying with QtSql classes.

EasyQtSql EasyQtSql is a lightweight header-only C++11 library for quick and easy SQL querying with QtSql classes. Features: Header only C++11 library

null 53 Dec 30, 2022
A friendly and lightweight C++ database library for MySQL, PostgreSQL, SQLite and ODBC.

QTL QTL is a C ++ library for accessing SQL databases and currently supports MySQL, SQLite, PostgreSQL and ODBC. QTL is a lightweight library that con

null 173 Dec 12, 2022
A very fast lightweight embedded database engine with a built-in query language.

upscaledb 2.2.1 Fr 10. Mär 21:33:03 CET 2017 (C) Christoph Rupp, [email protected]; http://www.upscaledb.com This is t

Christoph Rupp 542 Dec 30, 2022
Lightweight C++ wrapper for SQLite

NLDatabase Lightweight C++ wrapper for SQLite. Requirements C++11 compiler SQLite 3 Usage Let's open a database file and read some rows: #include "NLD

Raven 0 Sep 20, 2019
The official C++ client API for PostgreSQL.

libpqxx Welcome to libpqxx, the C++ API to the PostgreSQL database management system. Home page: http://pqxx.org/development/libpqxx/ Find libpqxx on

Jeroen Vermeulen 718 Jan 3, 2023
Beryl-cli is a client for the BerylDB database server

Beryl-cli is a client for the BerylDB database server. It offers multiple commands and is designed to be fast and user-friendly.

BerylDB 11 Oct 9, 2022
The PostgreSQL client API in modern C++

C++ client API to PostgreSQL {#mainpage} Dmitigr Pgfe (PostGres FrontEnd, hereinafter referred to as Pgfe) - is a C++ client API to PostgreSQL servers

Dmitry Igrishin 137 Dec 14, 2022
C++ client library for PostgreSQL

Welcome to taoPQ taoPQ is a lightweight C++ client library for accessing a PostgreSQL➚ database. It has no dependencies beyond libpq➚, the C applicati

The Art of C++ 232 Dec 22, 2022