2015-09-01 04:31:49 -07:00
|
|
|
#ifndef _GCACHE_H_INCLUDED_
|
|
|
|
# define _GCACHE_H_INCLUDED_
|
|
|
|
|
|
|
|
#ifdef HAVE_LMDB
|
|
|
|
|
|
|
|
#include "json.h"
|
|
|
|
#include "lmdb.h"
|
|
|
|
|
|
|
|
#define LMDB_DB_SIZE (120 * 1024 * 1024)
|
|
|
|
|
|
|
|
struct gcache {
|
|
|
|
MDB_env *env;
|
|
|
|
MDB_dbi dbi;
|
|
|
|
};
|
|
|
|
|
2015-09-07 04:48:47 -07:00
|
|
|
struct gcache *gcache_open(char *path, char *dbname, int rdonly);
|
2015-09-01 04:31:49 -07:00
|
|
|
void gcache_close(struct gcache *);
|
|
|
|
int gcache_put(struct gcache *, char *ghash, char *payload);
|
|
|
|
int gcache_json_put(struct gcache *, char *ghash, JsonNode *geo);
|
2015-09-07 04:48:47 -07:00
|
|
|
long gcache_get(struct gcache *, char *key, char *buf, long buflen);
|
2015-09-01 04:31:49 -07:00
|
|
|
JsonNode *gcache_json_get(struct gcache *, char *key);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
#endif
|