1 #ifndef _MOD_MAGNET_CACHE_H_ 2 #define _MOD_MAGNET_CACHE_H_ 3 #include "first.h" 4 5 #include "base_decls.h" 6 #include "buffer.h" 7 8 #include <lua.h> 9 10 typedef struct { 11 buffer *name; 12 buffer *etag; 13 14 lua_State *L; 15 16 time_t last_used; /* LRU */ 17 } script; 18 19 typedef struct { 20 script **ptr; 21 uint32_t used; 22 uint32_t size; 23 } script_cache; 24 25 script_cache *script_cache_init(void); 26 void script_cache_free_data(script_cache *cache); 27 28 lua_State *script_cache_get_script(script_cache *cache, buffer *name, int etag_flags); 29 30 #endif 31