diff options
author | Ziv Scully <ziv@mit.edu> | 2015-06-28 12:46:51 -0700 |
---|---|---|
committer | Ziv Scully <ziv@mit.edu> | 2015-06-28 12:46:51 -0700 |
commit | 24edb607ef64db1ab12b3d5b9ccd3848c50780d1 (patch) | |
tree | 933a65e83f09da4b6d061a0bc2335cebb087d70d /include/urweb/types_cpp.h | |
parent | ca3efa1458583772a9826198ed4b99eec381f2de (diff) |
Progress on LRU cache but still more known bugs to fix.
Diffstat (limited to 'include/urweb/types_cpp.h')
-rw-r--r-- | include/urweb/types_cpp.h | 31 |
1 files changed, 31 insertions, 0 deletions
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 |