wingunder/redis-plus-plus-modules 6
This library aims to supply a C++ interface to all major/popular Redis modules.
diff template library written by C++
C++ CSV parser library
Redis client written in C++
Makefile for Arduino sketches. It defines the workflows for compiling code, flashing it to Arduino and even communicating through Serial.
In application debugger for ARM Cortex microcontrollers.
Dual-mode Bluetooth stack, with small memory footprint.
Teensy Core Libraries for Arduino
Emacs setup for C/C++ with Helm describe here: http://tuhdo.github.io/c-ide.html
issue commentsewenew/redis-plus-plus
@portsip
folly::Futuredoesn't supportfolly::Future<void>, instead it has afolly::Future<folly::Unit>. So you have to do some tricky thing, i.e. make a proxy forfolly::Future. You can replacesrc/sw/redis++/async_utils.hwith the following code:#ifndef SEWENEW_REDISPLUSPLUS_ASYNC_UTILS_H #define SEWENEW_REDISPLUSPLUS_ASYNC_UTILS_H #include <folly/futures/Future.h> namespace sw { namespace redis { template <typename T> struct Future { explicit Future(folly::Future<T> fut) : future(std::move(fut)) {} folly::Future<T> future; }; template <> struct Future<void> { explicit Future(folly::Future<folly::Unit> fut) : future(std::move(fut)) {} folly::Future<folly::Unit> future; }; template <typename T> struct Promise { Future<T> get_future() { return Future<T>(promise.getFuture()); } void set_value(T &&val) { promise.setValue(std::move(val)); } void set_exception(std::exception_ptr err) { promise.setException(folly::exception_wrapper::from_exception_ptr(err)); } folly::Promise<T> promise; }; template <> struct Promise<void> { Future<void> get_future() { return Future<void>(promise.getFuture()); } void set_value() { promise.setValue(); } void set_exception(std::exception_ptr err) { promise.setException(folly::exception_wrapper::from_exception_ptr(err)); } folly::Promise<folly::Unit> promise; }; } } #endif // end SEWENEW_REDISPLUSPLUS_ASYNC_UTILS_HNOTE: you need to build the redis-plus-plus with
-DREDIS_PLUS_PLUS_CXX_STANDARD=17, i.e. build the code with c++17 standard.folly depends on lots of other libs, so you need to link your application with those libs. For example:
c++ -std=c++17 -o app app.cpp -lredis++ -lhiredis -pthread -lfolly -lglog -lgflags -pthread -ldl -levent -ldouble-conversion -lboost_context -liberty -lfmt -luvRegards
Git it, thanks a lot.
comment created time in 12 hours
issue commentsewenew/redis-plus-plus
@portsip folly::Future doesn't support folly::Future<void>, instead it has a folly::Future<folly::Unit>. So you have to do some tricky thing, i.e. make a proxy forfolly::Future. You can replace src/sw/redis++/async_utils.h with the following code:
#ifndef SEWENEW_REDISPLUSPLUS_ASYNC_UTILS_H
#define SEWENEW_REDISPLUSPLUS_ASYNC_UTILS_H
#include <folly/futures/Future.h>
namespace sw {
namespace redis {
template <typename T>
struct Future {
explicit Future(folly::Future<T> fut) : future(std::move(fut)) {}
folly::Future<T> future;
};
template <>
struct Future<void> {
explicit Future(folly::Future<folly::Unit> fut) : future(std::move(fut)) {}
folly::Future<folly::Unit> future;
};
template <typename T>
struct Promise {
Future<T> get_future() {
return Future<T>(promise.getFuture());
}
void set_value(T &&val) {
promise.setValue(std::move(val));
}
void set_exception(std::exception_ptr err) {
promise.setException(folly::exception_wrapper::from_exception_ptr(err));
}
folly::Promise<T> promise;
};
template <>
struct Promise<void> {
Future<void> get_future() {
return Future<void>(promise.getFuture());
}
void set_value() {
promise.setValue();
}
void set_exception(std::exception_ptr err) {
promise.setException(folly::exception_wrapper::from_exception_ptr(err));
}
folly::Promise<folly::Unit> promise;
};
}
}
#endif // end SEWENEW_REDISPLUSPLUS_ASYNC_UTILS_H
NOTE: you need to build the redis-plus-plus with -DREDIS_PLUS_PLUS_CXX_STANDARD=17, i.e. build the code with c++17 standard.
folly depends on lots of other libs, so you need to link your application with those libs. For example:
c++ -std=c++17 -o app app.cpp -lredis++ -lhiredis -pthread -lfolly -lglog -lgflags -pthread -ldl -levent -ldouble-conversion -lboost_context -liberty -lfmt -luv
Regards
comment created time in 14 hours
startedmiurahr/aqtinstall
started time in a day
startedjurplel/install-qt-action
started time in a day
issue commentsewenew/redis-plus-plus
In fact, an elegant implementation of future should give an option to run the callback in thread pool. Take boost for example, you can set a thread pool when you call the
thenmethod.If you can use boost, you can try the following:
- replace src/sw/redis++/async_utils.h with the following code:
#ifndef SEWENEW_REDISPLUSPLUS_ASYNC_UTILS_H #define SEWENEW_REDISPLUSPLUS_ASYNC_UTILS_H //#include <future> #define BOOST_THREAD_PROVIDES_FUTURE #define BOOST_THREAD_PROVIDES_FUTURE_CONTINUATION #define BOOST_THREAD_PROVIDES_EXECUTORS #include <boost/thread/future.hpp> namespace sw { namespace redis { template <typename T> using Future = boost::future<T>; //using Future = std::future<T>; template <typename T> using Promise = boost::promise<T>; //using Promise = std::promise<T>; } } #endif
- build and install redis-plus-plus.
- use it as the following example:
#include <sw/redis++/async_redis++.h> #include <boost/thread/executors/basic_thread_pool.hpp> boost::executors::basic_thread_pool pool(3); ConnectionOptions opts; opts.host = "127.0.01"; opts.port = 6379; auto async_redis = AsyncRedis(opts); async_redis.get("key").then(pool, [](Future<OptionalString> f) { auto val = f.get(); if (val) cout << *val << endl; });There's a plan to support boost and other popular future libs, and will have a cmake option to let user choose between these libs.
Regards
Please consider supporting Facebook folly future. Thanks
comment created time in 2 days
issue commentsewenew/redis-plus-plus
How to install it with FetchContent_Declare in cmake ?
okay. thanks for the reply.
comment created time in 2 days
issue commentsewenew/redis-plus-plus
How to install it with FetchContent_Declare in cmake ?
@vishnucool220 Sorry, but so far, it doesn't support FetchContent. I did some research before, it seems that FetchContent do the dependency check at configuration step. However, redis-plus-plus depends on the installation of hiredis. That's why it complains that it cannot find HIREDIS_LIB.
Regards
comment created time in 2 days
issue commentsewenew/redis-plus-plus
Of course, you can assign a DNS to ConnectionOptions::host. It will be resolved to IP address automatically.
Regards
comment created time in 2 days
issue commentsewenew/redis-plus-plus
How to install it with FetchContent_Declare in cmake ?
@sewenew i tried using fetchContent but got the errore
Detected version: 1.0.0 1> [CMake] -- redis-plus-plus version: 1.2.1 1> [CMake] -- The CXX standard is c++11 1> [CMake] CMake Error: The following variables are used in this project, but they are set to NOTFOUND. 1> [CMake] Please set them or make sure they are set and tested correctly in the CMake files: 1> [CMake] HIREDIS_LIB 1> [CMake] linked by target "redis-plus-plus-shared" in directory /mnt/c/Users/marthala/Documents/workspace/KEBPLCComService/out/build/WSL-GCC-Debug/_deps/redis-plus-plus-src 1> [CMake] HIREDIS_STATIC_LIB 1> [CMake] linked by target "test_redis++" in directory /mnt/c/Users/marthala/Documents/workspace/KEBPLCComService/out/build/WSL-GCC-Debug/_deps/redis-plus-plus-src/test 1> [CMake]
include(FetchContent) FetchContent_Declare( hiredis GIT_REPOSITORY https://github.com/redis/hiredis.git GIT_TAG v1.0.0 ) FetchContent_MakeAvailable(hiredis) target_link_libraries(your-project PRIVATE hiredis::hiredis)
FetchContent_Declare( redis-plus-plus GIT_REPOSITORY https://github.com/sewenew/redis-plus-plus.git GIT_TAG 1.2.2 ) FetchContent_MakeAvailable(redis-plus-plus) target_link_libraries(your-project PRIVATE redis-plus-plus::redis-plus-plus)
comment created time in 2 days
startedmuellan/clipp
started time in 2 days
startedconcurrencykit/ck
started time in 2 days
issue openedsewenew/redis-plus-plus
I'd like to connect to elasticache. However, aws strongly recommends connecting using dns. Is this possible using redis-plus-plus? Apologies as I might have totally missed something.
For example:
sw::redis::ConnectionOptions connection_options; connection_options.host = "test-elasticache.2wnzk3.0002.use2.cache.amazonaws.com"; connection_options.port = 6379; sw::redis::RedisCluster(connection_options);
created time in 2 days
startedsharkdp/fd
started time in 3 days
startedthlorenz/doctoc
started time in 3 days
issue commentsewenew/redis-plus-plus
How to install it with FetchContent_Declare in cmake ?
@sewenew is this issue fixed with using cmake fetchcontect?
comment created time in 3 days
startedyzhang-gh/vscode-markdown
started time in 3 days
startedsethen/markdown-include
started time in 3 days
startedargtable/argtable3
started time in 3 days
startedp-ranav/awesome-hpp
started time in 3 days
startedgocardless/statesman
started time in 4 days
startedGNOME/libxml2
started time in 4 days
startedkakwa/libvisio2svg
started time in 4 days
issue commentsewenew/redis-plus-plus
@wingunder The async interface is partially done. It doesn't support Redis Sentinel and Redis Cluster. Recently I don't have enough time to finish it. The Bloom filter support was plan to support Bloom filter data structure with or without the Bloom filter module, and it was planed before the creation of redis-plus-plus-modules. Now, since we have redis-plus-plus-modules to work with Redis Modules, I'll remove this TODO from the list.
Regards
comment created time in 4 days
startedBwar/Nebula
started time in 4 days
startedsmxi/inxi
started time in 4 days
startedchronoxor/CppCommon
started time in 5 days
starteddavidmoreno/onion
started time in 5 days
fork redis-developer/redis-plus-plus-modules
This library aims to supply a C++ interface to all major/popular Redis modules.
fork in 5 days
startedsnikulov/cmake-modules
started time in 6 days
startedCloudWebManage/cwm-worker-operator
started time in 7 days