Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Balancer by lua stream #25

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
shared dictionary incr method exptime added to FFI api
splitice committed Dec 28, 2015
commit 1ff2dea44d0281a16c7f6c911a1f7fa147ed5d60
8 changes: 5 additions & 3 deletions lib/resty/core/shdict.lua
Original file line number Diff line number Diff line change
@@ -26,7 +26,7 @@ ffi.cdef[[
int get_stale, int *is_stale);

int ngx_http_lua_ffi_shdict_incr(void *zone, const unsigned char *key,
size_t key_len, double *value, char **err);
size_t key_len, double *value, int exptime, char **err);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm afraid these changes are irrelevant and should be removed out of this PR.


int ngx_http_lua_ffi_shdict_store(void *zone, int op,
const unsigned char *key, size_t key_len, int value_type,
@@ -311,7 +311,7 @@ local function shdict_get_stale(zone, key)
end


local function shdict_incr(zone, key, value)
local function shdict_incr(zone, key, value, exptime)
zone = check_zone(zone)

if key == nil then
@@ -334,9 +334,11 @@ local function shdict_incr(zone, key, value)
value = tonumber(value)
end
num_value[0] = value

exptime = exptime or -1

local rc = C.ngx_http_lua_ffi_shdict_incr(zone, key, key_len, num_value,
errmsg)
exptime, errmsg)
if rc ~= 0 then -- ~= NGX_OK
return nil, ffi_str(errmsg[0])
end