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 int req_env_init; 16 } script; 17 18 typedef struct { 19 script **ptr; 20 uint32_t used; 21 uint32_t size; 22 } script_cache; 23 24 #if 0 25 __attribute_cold__ 26 __attribute_malloc__ 27 __attribute_returns_nonnull__ 28 script_cache *script_cache_init(void); 29 #endif 30 31 __attribute_cold__ 32 void script_cache_free_data(script_cache *cache); 33 34 __attribute_cold__ 35 __attribute_nonnull__() 36 __attribute_returns_nonnull__ 37 script *script_cache_get_script(script_cache *cache, const buffer *name); 38 39 __attribute_nonnull__() 40 lua_State *script_cache_check_script(script * const sc, int etag_flags); 41 42 #endif 43