aboutsummaryrefslogtreecommitdiffstats
path: root/testing/uwsgi/lua-cache-update.patch
diff options
context:
space:
mode:
authorKaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>2013-03-07 09:25:54 +0000
committerKaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>2013-03-07 09:27:21 +0000
commit02608d80cbe6f907dc29b0a1612f5cacd11d42a9 (patch)
treeb45c1d3747b7dedea75db39738cdef5145eeee5f /testing/uwsgi/lua-cache-update.patch
parent145344949e4754123186613cd9ed6254b990af28 (diff)
downloadaports-02608d80cbe6f907dc29b0a1612f5cacd11d42a9.tar.bz2
aports-02608d80cbe6f907dc29b0a1612f5cacd11d42a9.tar.xz
testing/uwsgi: Lua binding for cache update function
Diffstat (limited to 'testing/uwsgi/lua-cache-update.patch')
-rw-r--r--testing/uwsgi/lua-cache-update.patch45
1 files changed, 45 insertions, 0 deletions
diff --git a/testing/uwsgi/lua-cache-update.patch b/testing/uwsgi/lua-cache-update.patch
new file mode 100644
index 0000000000..6943a97c9a
--- /dev/null
+++ b/testing/uwsgi/lua-cache-update.patch
@@ -0,0 +1,45 @@
+--- uwsgi-1.4.3/plugins/lua/lua_plugin.c
++++ uwsgi-1.4.3.new/plugins/lua/lua_plugin.c
+@@ -157,6 +157,34 @@
+
+ }
+
++static int uwsgi_api_cache_update(lua_State *L) {
++
++ int args = lua_gettop(L);
++ const char *key ;
++ const char *value ;
++ uint64_t expires = 0;
++ size_t vallen;
++
++
++ if (args > 1) {
++
++ key = lua_tolstring(L, 1, NULL);
++ value = lua_tolstring(L, 2, &vallen);
++ if (args > 2) {
++ expires = lua_tonumber(L, 3);
++ }
++
++ uwsgi_cache_set((char *)key, strlen(key), (char *)value,
++ (uint16_t) vallen, expires,
++ UWSGI_CACHE_FLAG_UPDATE);
++
++ }
++
++ lua_pushnil(L);
++ return 1;
++
++}
++
+ static int uwsgi_api_register_signal(lua_State *L) {
+
+ int args = lua_gettop(L);
+@@ -298,6 +326,7 @@
+ {"send_message", uwsgi_api_send_message},
+ {"cache_get", uwsgi_api_cache_get},
+ {"cache_set", uwsgi_api_cache_set},
++ {"cache_update", uwsgi_api_cache_update},
+ {"register_signal", uwsgi_api_register_signal},
+ {"register_rpc", uwsgi_api_register_rpc},
+ {NULL, NULL}