From 24edb607ef64db1ab12b3d5b9ccd3848c50780d1 Mon Sep 17 00:00:00 2001 From: Ziv Scully Date: Sun, 28 Jun 2015 12:46:51 -0700 Subject: Progress on LRU cache but still more known bugs to fix. --- include/urweb/types_cpp.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'include/urweb/types_cpp.h') diff --git a/include/urweb/types_cpp.h b/include/urweb/types_cpp.h index 0c431ff8..2f154e1f 100644 --- a/include/urweb/types_cpp.h +++ b/include/urweb/types_cpp.h @@ -119,4 +119,35 @@ typedef struct { char *start, *front, *back; } uw_buffer; +// Caching + +#include "uthash.h" + +typedef struct CacheValue { + char *result; + char *output; +} CacheValue; + +typedef struct CacheEntry { + char *key; + void *value; + time_t timeValid; + struct CacheEntry *prev; + struct CacheEntry *next; + UT_hash_handle hh; +} CacheEntry; + +typedef struct CacheList { + CacheEntry *first; + CacheEntry *last; + int size; +} CacheList; + +typedef struct Cache { + CacheEntry *table; + time_t timeInvalid; + CacheList *lru; + int height; +} Cache; + #endif -- cgit v1.2.3