File: db-redis.h

package info (click to toggle)
minetestmapper 20180325-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 236 kB
  • sloc: cpp: 2,101; ansic: 32; makefile: 9; sh: 9
file content (25 lines) | stat: -rw-r--r-- 570 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#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);
	virtual ~DBRedis();
private:
	static std::string replyTypeStr(int type);

	void loadPosCache();
	void HMGET(const std::vector<BlockPos> &positions, std::vector<ustring> *result);

	std::vector<BlockPos> posCache;

	redisContext *ctx;
	std::string hash;
};

#endif // DB_REDIS_HEADER