diff options
author | Adam Chlipala <adam@chlipala.net> | 2015-12-20 14:18:52 -0500 |
---|---|---|
committer | Adam Chlipala <adam@chlipala.net> | 2015-12-20 14:18:52 -0500 |
commit | 68b355524cc20056d8c059138be225aaa9762e0a (patch) | |
tree | 6c9a407a965d2cdd5f30815cc3e642a6f9b3d451 /include/urweb/types_cpp.h | |
parent | 7bf4f9f063dcdc9fc50ad6ac6143b113535b68f0 (diff) | |
parent | 0271786bacdf9c12a142367a479b24ba111ebd17 (diff) |
Merge Sqlcache
Diffstat (limited to 'include/urweb/types_cpp.h')
-rw-r--r-- | include/urweb/types_cpp.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/include/urweb/types_cpp.h b/include/urweb/types_cpp.h index 0c431ff8..ce0f2825 100644 --- a/include/urweb/types_cpp.h +++ b/include/urweb/types_cpp.h @@ -119,4 +119,27 @@ typedef struct { char *start, *front, *back; } uw_buffer; +// Caching + +#include <pthread.h> +#include "uthash.h" + +typedef struct uw_Sqlcache_Value { + char *result; + char *output; + unsigned long timeValid; +} uw_Sqlcache_Value; + +typedef struct uw_Sqlcache_Entry uw_Sqlcache_Entry; + +typedef struct uw_Sqlcache_Cache { + pthread_rwlock_t lockOut; + pthread_rwlock_t lockIn; + uw_Sqlcache_Entry *table; + unsigned long timeInvalid; + unsigned long timeNow; + size_t numKeys; + UT_hash_handle hh; +} uw_Sqlcache_Cache; + #endif |