Newer
Older
RedisProvider::RedisProvider(std::string ip, int port, std::string key) {
redisReply *r = (redisReply *) redisCommand(context, "LPUSH %s %b","DAQ_key", (char *)packet.getBufferPtr(), (size_t) packet.getPacketSize());
if(r)
return 1;
return -1;
int RedisProvider::write(BasePacket &packet, std::string key) {
redisReply *r = (redisReply *) redisCommand(context, "LPUSH %s %b",key, (char *)packet.getBufferPtr(), (size_t) packet.getPacketSize());
if(r)
return 1;
return -1;
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;
}