summaryrefslogtreecommitdiff
path: root/proxy_lua.c
diff options
context:
space:
mode:
authordormando <dormando@rydia.net>2023-01-12 12:17:08 -0800
committerdormando <dormando@rydia.net>2023-02-25 15:07:01 -0800
commitf012c9cb3516933b0fce54e12d358e697c24863d (patch)
tree133a41d279be9895c5258b830f6705ea9fbf1268 /proxy_lua.c
parent6442017c545a2a5ad076697b8695cd64bd32b542 (diff)
downloadmemcached-f012c9cb3516933b0fce54e12d358e697c24863d.tar.gz
proxy: add mcp.internal(r) API
local res = mcp.internal(r) - takes a request object and executes it against the proxy's internal cache instance. Experimental as of this commit. Needs more test coverage and benchmarking.
Diffstat (limited to 'proxy_lua.c')
-rw-r--r--proxy_lua.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/proxy_lua.c b/proxy_lua.c
index aeaf1e5..ede23bb 100644
--- a/proxy_lua.c
+++ b/proxy_lua.c
@@ -90,6 +90,13 @@ static int mcplib_response_gc(lua_State *L) {
free(r->buf);
}
+ // release our temporary mc_resp sub-object.
+ if (r->cresp != NULL) {
+ mc_resp *cresp = r->cresp;
+ assert(r->thread != NULL);
+ resp_free(r->thread, cresp);
+ }
+
return 0;
}
@@ -1188,6 +1195,7 @@ int proxy_register_libs(void *ctx, LIBEVENT_THREAD *t, void *state) {
};
const struct luaL_Reg mcplib_f [] = {
+ {"internal", mcplib_internal},
{"pool", mcplib_pool},
{"backend", mcplib_backend},
{"request", mcplib_request},