1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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}
|