add: cache (WIP)
This commit is contained in:
parent
f167f9caec
commit
6d37bd9734
26 changed files with 365 additions and 61 deletions
include
|
@ -3,9 +3,52 @@
|
|||
|
||||
#include <sqlite3.h>
|
||||
|
||||
#include <models/schedule.h>
|
||||
#include <models/relay.h>
|
||||
#include <models/controller.h>
|
||||
|
||||
extern sqlite3 *cache_database;
|
||||
|
||||
void
|
||||
cache_init();
|
||||
|
||||
void
|
||||
cache_free();
|
||||
|
||||
|
||||
void
|
||||
cache_put_json_schedule(int schedule_id, char *schedule_json);
|
||||
|
||||
char*
|
||||
cache_get_json_schedule(int schedule_id);
|
||||
|
||||
void
|
||||
cache_invalidate_schedule(int schedule_id);
|
||||
|
||||
|
||||
void
|
||||
cache_put_json_relay(int relay_id, char *relay_json);
|
||||
|
||||
char*
|
||||
cache_get_json_relay(int relay_id);
|
||||
|
||||
void
|
||||
cache_invalidate_relay(int relay_id);
|
||||
|
||||
|
||||
|
||||
void
|
||||
cache_put_json_controller(int controller_id, char *controller_json);
|
||||
|
||||
char*
|
||||
cache_get_json_controller(int controller_id);
|
||||
|
||||
void
|
||||
cache_invalidate_controller(int controller_id);
|
||||
|
||||
|
||||
|
||||
void
|
||||
cache_invalidate_tagged(int tag_id);
|
||||
|
||||
#endif /* CORE_CACHE_H */
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
#include <sqlite3.h>
|
||||
|
||||
#include <constants.h>
|
||||
#include <cJSON.h>
|
||||
#include <helpers.h>
|
||||
#include <models/relay.h>
|
||||
|
||||
|
@ -32,7 +31,7 @@ controller_save(controller_t* contoller);
|
|||
int
|
||||
controller_remove(controller_t* contoller);
|
||||
|
||||
cJSON*
|
||||
char*
|
||||
controller_to_json(controller_t* contoller);
|
||||
|
||||
controller_t*
|
||||
|
|
|
@ -19,9 +19,6 @@ junction_tag_insert(int tag_id, int relay_id, int schedule_id);
|
|||
int
|
||||
junction_tag_remove(int tag_id, int relay_id, int schedule_id);
|
||||
|
||||
int
|
||||
junction_tag_remove_for_tag(int tag_id);
|
||||
|
||||
int
|
||||
junction_tag_remove_for_relay(int relay_id);
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
#include <uuid/uuid.h>
|
||||
|
||||
#include <constants.h>
|
||||
#include <cJSON.h>
|
||||
#include <helpers.h>
|
||||
#include <database.h>
|
||||
#include <models/schedule.h>
|
||||
|
@ -28,10 +27,10 @@ relay_save();
|
|||
void
|
||||
relay_reload_active_schedule(relay_t *relay);
|
||||
|
||||
cJSON*
|
||||
char*
|
||||
relay_to_json(relay_t *relay);
|
||||
|
||||
cJSON*
|
||||
char*
|
||||
relay_list_to_json(relay_t **relays);
|
||||
|
||||
void
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
#include <uuid/uuid.h>
|
||||
|
||||
#include <cJSON.h>
|
||||
#include <constants.h>
|
||||
#include <models/period.h>
|
||||
|
||||
|
@ -31,7 +30,7 @@ schedule_free(schedule_t *schedule);
|
|||
void
|
||||
schedule_free_list(schedule_t **schedule);
|
||||
|
||||
cJSON*
|
||||
char*
|
||||
schedule_to_json(schedule_t *schedule);
|
||||
|
||||
void
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue