Mercurial > urweb
comparison include/urweb/types_cpp.h @ 2234:2f7ed04332a0
Progress on LRU cache but still more known bugs to fix.
author | Ziv Scully <ziv@mit.edu> |
---|---|
date | Sun, 28 Jun 2015 12:46:51 -0700 |
parents | c93fbd139732 |
children | 88cc0f44c940 |
comparison
equal
deleted
inserted
replaced
2233:af1585e7d645 | 2234:2f7ed04332a0 |
---|---|
117 typedef struct { | 117 typedef struct { |
118 size_t max; | 118 size_t max; |
119 char *start, *front, *back; | 119 char *start, *front, *back; |
120 } uw_buffer; | 120 } uw_buffer; |
121 | 121 |
122 // Caching | |
123 | |
124 #include "uthash.h" | |
125 | |
126 typedef struct CacheValue { | |
127 char *result; | |
128 char *output; | |
129 } CacheValue; | |
130 | |
131 typedef struct CacheEntry { | |
132 char *key; | |
133 void *value; | |
134 time_t timeValid; | |
135 struct CacheEntry *prev; | |
136 struct CacheEntry *next; | |
137 UT_hash_handle hh; | |
138 } CacheEntry; | |
139 | |
140 typedef struct CacheList { | |
141 CacheEntry *first; | |
142 CacheEntry *last; | |
143 int size; | |
144 } CacheList; | |
145 | |
146 typedef struct Cache { | |
147 CacheEntry *table; | |
148 time_t timeInvalid; | |
149 CacheList *lru; | |
150 int height; | |
151 } Cache; | |
152 | |
122 #endif | 153 #endif |