profile
viewpoint
If you are wondering where the data of this site comes from, please visit https://api.github.com/users/wingunder/events. GitMemory does not store any data, but only uses NGINX to cache data for a period of time. The idea behind GitMemory is simply to give users a better reading experience.

wingunder/redis-plus-plus-modules 6

This library aims to supply a C++ interface to all major/popular Redis modules.

wingunder/dtl 1

diff template library written by C++

wingunder/rapidcsv 1

C++ CSV parser library

wingunder/redis-plus-plus 1

Redis client written in C++

wingunder/Arduino-Makefile 0

Makefile for Arduino sketches. It defines the workflows for compiling code, flashing it to Arduino and even communicating through Serial.

wingunder/blackmagic 0

In application debugger for ARM Cortex microcontrollers.

wingunder/btstack 0

Dual-mode Bluetooth stack, with small memory footprint.

wingunder/cores 0

Teensy Core Libraries for Arduino

wingunder/emacs-c-ide-demo 0

Emacs setup for C/C++ with Helm describe here: http://tuhdo.github.io/c-ide.html

issue commentsewenew/redis-plus-plus

About the async interface.

@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

Git it, thanks a lot.

portsip

comment created time in 12 hours

issue commentsewenew/redis-plus-plus

About the async interface.

@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

portsip

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

About the async interface.

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 then method.

If you can use boost, you can try the following:

  1. 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
  1. build and install redis-plus-plus.
  2. 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

portsip

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.

DachuanZhao

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

DachuanZhao

comment created time in 2 days

issue commentsewenew/redis-plus-plus

elasticache

Of course, you can assign a DNS to ConnectionOptions::host. It will be resolved to IP address automatically.

Regards

jdilla52

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)

DachuanZhao

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

elasticache

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?

DachuanZhao

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

TODO LIST

@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

sewenew

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