Show HN: Cpp_Redis – C++11 Lightweight Redis client
github.com
github.com
namespace redis = cpp_redis;
there you go. redis::redis_client
a bit better, but not redis::client"Why does namespace need explicit "cpp_" prefix?" I get used to namespace by the library name for each library I build. I believe it does make sense, I think here the issue is maybe more about the library name itself. As other people suggested, it is still possible to create an alias for this namespace
"Why do classes inside "cpp_redis" namespace still have "redis_" prefix?" I 100% agree and I think I will change that! It is also inconsistent as I got a `redis_client` class but at the same time a `future_client` without redis_prefix. I definitely makes more sense to name it only redis and I'll make that change later on:)
Thanks foryour feedback though :)
However, given it is a C API you will get the usual C unsafe code, instead of C++'s improvements regarding type safety.
Wouldn't one compile hiredis in C, their app in C++, and link the two together?
In general compiling C code with a C++ compiler isn't the path of least resistance.
And even if some things leak into the headers they might be accepted by compiler extensions.
But yes, in general if a c library's headers are hostile to cross-language usage then using it from c++ won't be trivial.
I suggest using git tags instead of putting a version number in every commit message.
Have you looked into epoll or kqueue or even poll? Or for your windows backend, WSAEventSelect/WaitForMultipleObjects or IOCP... Trying to get all these disparate ways of doing async sockets to use a consistent wrapper interface is an interesting challenge.
I do use git tags but I also include version numbers in my commit messages so that I can easily determine in which version a given commit was published. I find it pretty useful. I know some people prefer to create a dev branch, then squash merge, but sometimes you got multiple features and I feel it is more convenient to separate them into multiple commits that will belongs to the same release. Do you have some other suggestions, I would be interested :)
Concerning epoll/poll, the networking part was first based on it. However, the poll implementation on windows is buggy and thus it is more advised to use select on windows apparently... So to keep consistency between unix and windows versions, I decided to switch back to select for both platform for now. I'm planning to switch back to poll for unix and look at WSAEventSelect.
I also looked at IOCP and it is really interesting. However, it is pretty hard to implement a portable library that uses select/poll under unix but IOCP on windows as the implementation is pretty different. There are some ways, but the way I designed the networking part does not make it possible without changing completely the design on one platform
If we look at a commit on github, I'll see all tags that contain that commit:
https://i.imgur.com/KTkz2K1.png
So I know this commit was created before the 3.3.0 tag (and all later tags).
You can do the same thing at the command line with:
git tag --contains 009bdeedbc
which would display the same information.(it also shows tags similar to branch heads)
Does it require low latency? Yes -> use Clang environment. In this case, redis usually doesn't fit the bill within the stack. I'm surprised for most other use cases, people are using C++, where Ruby/Java can provide a solid programming abstraction (and fast development time). tl;dr I would be curious of the use case of C++ and redis.