diff options
author | Ziv Scully <ziv@mit.edu> | 2015-11-11 20:01:48 -0500 |
---|---|---|
committer | Ziv Scully <ziv@mit.edu> | 2015-11-11 20:01:48 -0500 |
commit | 7b14b2f01fd0218c0bbe0a5c4071fff190c91ce1 (patch) | |
tree | 3d666922cee1091bb7f576127181f622cd944d88 /include/urweb/types_cpp.h | |
parent | b7d668bb4647c4216df7120b4b8f8d5c6e8257f0 (diff) |
Rewrite LRU cache. Now uses one big hash table and is less buggy.
Diffstat (limited to 'include/urweb/types_cpp.h')
-rw-r--r-- | include/urweb/types_cpp.h | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/include/urweb/types_cpp.h b/include/urweb/types_cpp.h index 84423105..4847a3fd 100644 --- a/include/urweb/types_cpp.h +++ b/include/urweb/types_cpp.h @@ -123,31 +123,24 @@ typedef struct { #include "uthash.h" -typedef struct uw_Sqlcache_CacheValue { +typedef struct uw_Sqlcache_Value { char *result; char *output; -} uw_Sqlcache_CacheValue; + unsigned long timeValid; +} uw_Sqlcache_Value; -typedef struct uw_Sqlcache_CacheEntry { +typedef struct uw_Sqlcache_Entry { char *key; - void *value; - time_t timeValid; - struct uw_Sqlcache_CacheEntry *prev; - struct uw_Sqlcache_CacheEntry *next; + uw_Sqlcache_Value *value; + unsigned long timeInvalid; UT_hash_handle hh; -} uw_Sqlcache_CacheEntry; - -typedef struct uw_Sqlcache_CacheList { - uw_Sqlcache_CacheEntry *first; - uw_Sqlcache_CacheEntry *last; - int size; -} uw_Sqlcache_CacheList; +} uw_Sqlcache_Entry; typedef struct uw_Sqlcache_Cache { - uw_Sqlcache_CacheEntry *table; - time_t timeInvalid; - uw_Sqlcache_CacheList *lru; - int height; + struct uw_Sqlcache_Entry *table; + unsigned long timeInvalid; + unsigned long timeNow; + UT_hash_handle hh; } uw_Sqlcache_Cache; #endif |