Skip to content
This repository was archived by the owner on Apr 6, 2019. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2,473 changes: 2,473 additions & 0 deletions .doxygen

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ language: cpp
compiler:
- clang
- gcc
cache: ccache

cache: ccache

os:
- linux
Expand Down Expand Up @@ -35,4 +35,3 @@ install:
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then (redis-server&); fi

script: mkdir build && cd build && cmake .. -DBUILD_TESTS=true -DBUILD_EXAMPLES=true && make && ./bin/cpp_redis_tests

42 changes: 40 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,52 @@
# Changelog

## [v4.0.0](https://github.com/Cylix/cpp_redis/releases/tag/4.0.0)
### 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.



## [v3.5.4](https://github.com/Cylix/cpp_redis/releases/tag/3.5.4)
### Tag
`3.5.4`.
### Date
August 24th, 2017
### Changes
* bump tacopie to fix #85 - select keep sleeping and does not process incoming read/write events
* 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
None
* ZADD command
* CLIENT KILL
### Removals
None

Expand Down
17 changes: 14 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,17 @@ include_directories(${CPP_REDIS_INCLUDES} ${DEPS_INCLUDES})
###
# sources
###
set(SRC_DIRS "sources" "sources/network" "sources/builders" "includes/cpp_redis" "includes/cpp_redis/builders" "includes/cpp_redis/network")
set(SRC_DIRS "sources"
"sources/builders"
"sources/core"
"sources/misc"
"sources/network"
"includes/cpp_redis"
"includes/cpp_redis/builders"
"includes/cpp_redis/core"
"includes/cpp_redis/misc"
"includes/cpp_redis/network")

foreach(dir ${SRC_DIRS})
# get directory sources and headers
file(GLOB s_${dir} "${dir}/*.cpp")
Expand Down Expand Up @@ -138,11 +148,12 @@ ELSE ()
target_link_libraries(${PROJECT} pthread)
ENDIF (WIN32)

if(TACOPIE_LIBRARY)
if (TACOPIE_LIBRARY)
target_link_libraries(${PROJECT} ${TACOPIE_LIBRARY})
else()
target_link_libraries(${PROJECT} tacopie)
endif()
endif(TACOPIE_LIBRARY)


# __CPP_REDIS_READ_SIZE
IF (READ_SIZE)
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ cmake .. -DCMAKE_BUILD_TYPE=Release
make
# Run tests and examples
./bin/cpp_redis_tests
./bin/redis_subscriber
./bin/redis_client
./bin/subscriber
./bin/client
```

## 5. Code your changes
Expand Down
51 changes: 17 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,36 @@
</p>

# cpp_redis [![Build Status](https://travis-ci.org/Cylix/cpp_redis.svg?branch=master)](https://travis-ci.org/Cylix/cpp_redis)
`cpp_redis` is a C++11 Asynchronous Multi-Platform Lightweight Redis Client, with support for synchronous operations and pipelining.
`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](https://github.com/cylix/tacopie))

## Example
### cpp_redis::redis_client
### cpp_redis::client
```cpp
cpp_redis::redis_client client;
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<cpp_redis::reply> get_reply = client.get("hello");

client.sync_commit();
# or client.commit(); for synchronous call
//! or client.commit(); for synchronous call
```
`cpp_redis::redis_client` [full documentation](https://github.com/Cylix/cpp_redis/wiki/Redis-Client) and [detailed example](https://github.com/Cylix/cpp_redis/wiki/Examples#redis-client).
`cpp_redis::client` [full documentation](https://github.com/Cylix/cpp_redis/wiki/Redis-Client) and [detailed example](https://github.com/Cylix/cpp_redis/wiki/Examples#redis-client).
More about [cpp_redis::reply](https://github.com/Cylix/cpp_redis/wiki/Replies).

### cpp_redis::redis_subscriber
### cpp_redis::subscriber
```cpp
cpp_redis::redis_subscriber sub;
cpp_redis::subscriber sub;

sub.connect();

Expand All @@ -40,45 +44,24 @@ sub.psubscribe("*", [](const std::string& chan, const std::string& msg) {
});

sub.sync_commit();
# or sub.commit(); for synchronous call
```
`cpp_redis::redis_subscriber` [full documentation](https://github.com/Cylix/cpp_redis/wiki/Redis-Subscriber) and [detailed example](https://github.com/Cylix/cpp_redis/wiki/Examples#redis-subscriber).

### cpp_redis::future_client
```cpp
cpp_redis::future_client client;

client.connect();

auto set = client.set("hello", "42");
auto decrby = client.decrby("hello", 12);
auto get = client.get("hello");

client.sync_commit();
# or client.commit(); for synchronous call

std::cout << "set 'hello' 42: " << set.get() << std::endl;
std::cout << "After 'hello' decrement by 12: " << decrby.get() << std::endl;
std::cout << "get 'hello': " << get.get() << std::endl;
//! or sub.commit(); for synchronous call
```
`cpp_redis::future_client` [full documentation](https://github.com/Cylix/cpp_redis/wiki/Future-Client) and [detailed example](https://github.com/Cylix/cpp_redis/wiki/Examples#future-client).
`cpp_redis::subscriber` [full documentation](https://github.com/Cylix/cpp_redis/wiki/Redis-Subscriber) and [detailed example](https://github.com/Cylix/cpp_redis/wiki/Examples#redis-subscriber).

## Wiki
A [Wiki](https://github.com/Cylix/cpp_redis/wiki) is available and provides full documentation for the library as well as [installation explanations](https://github.com/Cylix/cpp_redis/wiki/Installation).

# Doxygen
A [Doxygen documentation](https://cylix.github.io/cpp_redis/html/index.html) is available and provides full API documentation for the library.

## License
`cpp_redis` is under [MIT License](LICENSE).

## Contributing
Please refer to [CONTRIBUTING.md](CONTRIBUTING.md).

## Special Thanks

* [Frank Pagliughi](https://github.com/fpagliughi) for adding support of futures to the library
* [Mike Moening](https://github.com/MikesAracade) for his unexpected and incredible great work aiming to port cpp_redis on Windows!
* [Tobias Gustafsson](https://github.com/tobbe303) for contributing and reporting issues
* Alexis Vasseur for reporting me issues and spending time helping me debugging
* Pawel Lopko for reporting me issues
[Mike Moening](https://github.com/MikesAracade) for his unexpected and incredible great work aiming to port cpp_redis on Windows, provides sentinel support and high availability support!

## Author
[Simon Ninon](http://simon-ninon.fr)
Loading