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 } script_cache; 22 23 #if 0 24 __attribute_cold__ 25 __attribute_malloc__ 26 __attribute_returns_nonnull__ 27 script_cache *script_cache_init(void); 28 #endif 29 30 __attribute_cold__ 31 void script_cache_free_data(script_cache *cache); 32 33 __attribute_cold__ 34 __attribute_nonnull__() 35 __attribute_returns_nonnull__ 36 script *script_cache_get_script(script_cache *cache, const buffer *name); 37 38 __attribute_nonnull__() 39 lua_State *script_cache_check_script(script * const sc, int etag_flags); 40 41 #endif 42