Newer
Older
RedisProvider::RedisProvider(std::string ip, int port, std::string key) {
int RedisProvider::write(PacketLib::BasePacket &packet) {
redisReply *r = (redisReply *) redisCommand(context, "LPUSH %s %b","DAQ_key", (char *)packet.getBinaryPointer(), (size_t)packet.getHeaderSize() + packet.getPayloadSize() + packet.getTailSize());
int RedisProvider::write(PacketLib::BasePacket &packet, std::string key) {
redisReply *r = (redisReply *) redisCommand(context, "LPUSH %s %b",key, (char *)packet.getBinaryPointer(), (size_t)packet.getHeaderSize() + packet.getPayloadSize() + packet.getTailSize());
context = redisConnect(getIp().c_str(), getPort());
if (context == NULL || context->err) {
if (context) {
printf("Error: %s\n", context->errstr);
} else {
printf("Can't allocate Redis context\n");
RedisProvider::~RedisProvider(){
std::cout << "Deleting Redis stream" << std::endl;
}