Giter Site home page Giter Site logo

linecode / cpp_redis Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cylix/cpp_redis

0.0 2.0 0.0 779 KB

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

License: MIT License

CMake 2.75% Shell 0.06% C++ 97.19%

cpp_redis's Introduction

cpp_redis Build Status

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

Requirement

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

Example

cpp_redis::redis_client

cpp_redis::redis_client client;

client.connect();

client.set("hello", "42");
client.get("hello", [](cpp_redis::reply& reply) {
  std::cout << reply << std::endl;
});

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

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

cpp_redis::redis_subscriber

cpp_redis::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.sync_commit();
# or sub.commit(); for synchronous call

cpp_redis::redis_subscriber full documentation and detailed example.

cpp_redis::future_client

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;

cpp_redis::future_client full documentation and detailed example.

Wiki

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

License

cpp_redis is under MIT License.

Contributing

Please refer to CONTRIBUTING.md.

Special Thanks

  • Frank Pagliughi for adding support of futures to the library
  • Mike Moening for his unexpected and incredible great work aiming to port cpp_redis on Windows!
  • Tobias Gustafsson for contributing and reporting issues
  • Alexis Vasseur for reporting me issues and spending time helping me debugging
  • Pawel Lopko for reporting me issues

Author

Simon Ninon

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.