2006-09-10 22:01:43 +00:00
|
|
|
#ifndef _MOD_MAGNET_CACHE_H_
|
|
|
|
#define _MOD_MAGNET_CACHE_H_
|
2016-03-19 15:14:35 +00:00
|
|
|
#include "first.h"
|
2006-09-10 22:01:43 +00:00
|
|
|
|
2018-03-25 07:45:05 +00:00
|
|
|
#include "base_decls.h"
|
2006-09-10 22:01:43 +00:00
|
|
|
#include "buffer.h"
|
|
|
|
|
2006-09-15 14:56:41 +00:00
|
|
|
#include <lua.h>
|
|
|
|
|
2006-09-10 22:01:43 +00:00
|
|
|
typedef struct {
|
|
|
|
buffer *name;
|
|
|
|
buffer *etag;
|
|
|
|
|
|
|
|
lua_State *L;
|
|
|
|
|
|
|
|
time_t last_used; /* LRU */
|
|
|
|
} script;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
script **ptr;
|
2019-12-05 08:16:25 +00:00
|
|
|
uint32_t used;
|
|
|
|
uint32_t size;
|
2006-09-10 22:01:43 +00:00
|
|
|
} script_cache;
|
|
|
|
|
|
|
|
script_cache *script_cache_init(void);
|
2019-10-26 06:00:09 +00:00
|
|
|
void script_cache_free_data(script_cache *cache);
|
2006-09-10 22:01:43 +00:00
|
|
|
|
2019-12-05 08:16:25 +00:00
|
|
|
lua_State *script_cache_get_script(script_cache *cache, buffer *name, int etag_flags);
|
2006-09-10 22:01:43 +00:00
|
|
|
|
|
|
|
#endif
|