Feature/redis (#23)
* Fix warning * (cmake) add a warning about 32/64 conversion problems. * simple redis clients * can publish to redis * redis subscribe * display messages received per second * verbose flag * (cmake) use clang only compile option -Wshorten-64-to-32 when compiling with clang
This commit is contained in:
committed by
GitHub
parent
afe8b966ad
commit
e77b9176f3
36
ws/IXRedisClient.h
Normal file
36
ws/IXRedisClient.h
Normal file
@ -0,0 +1,36 @@
|
||||
/*
|
||||
* IXRedisClient.h
|
||||
* Author: Benjamin Sergeant
|
||||
* Copyright (c) 2019 Machine Zone, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <functional>
|
||||
|
||||
namespace ix
|
||||
{
|
||||
class Socket;
|
||||
|
||||
class RedisClient {
|
||||
public:
|
||||
using OnRedisSubscribeCallback = std::function<void(const std::string&)>;
|
||||
|
||||
RedisClient() = default;
|
||||
~RedisClient() = default;
|
||||
|
||||
bool connect(const std::string& hostname,
|
||||
int port);
|
||||
|
||||
bool publish(const std::string& channel,
|
||||
const std::string& message);
|
||||
|
||||
bool subscribe(const std::string& channel,
|
||||
const OnRedisSubscribeCallback& callback);
|
||||
|
||||
private:
|
||||
std::shared_ptr<Socket> _socket;
|
||||
};
|
||||
}
|
||||
|
Reference in New Issue
Block a user