BOC v1.0: RS256 auth, Ledger integration, Prometheus metrics, CI/CD, backup
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
#ifndef CRT_CACHE_H
|
||||
#define CRT_CACHE_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <time.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct crt_cache crt_cache_t;
|
||||
typedef struct crt_cache_entry {
|
||||
char key[256];
|
||||
uint8_t* data;
|
||||
size_t len;
|
||||
time_t expires_at;
|
||||
struct crt_cache_entry* next;
|
||||
} crt_cache_entry_t;
|
||||
|
||||
crt_cache_t* crt_cache_create(size_t max_entries, time_t default_ttl_sec);
|
||||
void crt_cache_destroy(crt_cache_t* cache);
|
||||
|
||||
bool crt_cache_set(crt_cache_t* cache, const char* key, const void* data, size_t len);
|
||||
bool crt_cache_set_ttl(crt_cache_t* cache, const char* key, const void* data, size_t len, time_t ttl_sec);
|
||||
bool crt_cache_get(crt_cache_t* cache, const char* key, void* out, size_t* len);
|
||||
bool crt_cache_delete(crt_cache_t* cache, const char* key);
|
||||
void crt_cache_clear(crt_cache_t* cache);
|
||||
size_t crt_cache_size(crt_cache_t* cache);
|
||||
void crt_cache_evict_expired(crt_cache_t* cache);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user