#pragma once
#include <myapp/persistence/database.h>
#include <myapp/logging/logger.h>
#include <hiredis/hiredis.h>
#include <memory>

namespace myapp::persistence {

class redis_database : public database
{
public:
    redis_database(std::string connection_string, std::shared_ptr<logging::logger>);

public:
    void save_readout(std::string const& topic, std::string const& value) override;
    std::string last_readout(std::string const& topic) override;

private:
    std::shared_ptr<redisContext> ctx_;
    std::shared_ptr<logging::logger> logger_;
    std::string namespace_;
    int ttl_;
};

} /* namespace myapp::persistence */
