Add redis database backend

This commit is contained in:
Sfan5
2014-04-26 15:01:35 +02:00
parent 22d3e401f8
commit 2553e44e8d
7 changed files with 223 additions and 2 deletions

22
db-redis.h Normal file
View File

@ -0,0 +1,22 @@
#ifndef DB_REDIS_HEADER
#define DB_REDIS_HEADER
#include "db.h"
#include <hiredis.h>
class DBRedis : public DB {
public:
DBRedis(const std::string &mapdir);
virtual std::vector<BlockPos> getBlockPos();
virtual void getBlocksOnZ(std::map<int16_t, BlockList> &blocks, int16_t zPos);
~DBRedis();
private:
void loadPosCache();
std::vector<BlockPos> posCache;
redisContext *ctx;
std::string hash;
};
#endif // DB_REDIS_HEADER