-
Notifications
You must be signed in to change notification settings - Fork 2k
feature: add api in shdict: lpush, lpop, rpush, rpop, llen #586
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
Conversation
} | ||
|
||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style: 2 blank lines needed instead of 3.
@doujiang24 The feature implemented in this PR is awesome. I'll have a closer look as soon as I can manage (need to cut a new OpenResty release ASAP). |
Yes, this is great, thanks @doujiang24. I was going to look at implementing just one thing, as discussed in #552, but you went ahead and implemented a lot more of these. Maybe when you are up to the speed with this, you can also take a look at implementing ttl ( expire's cousin, :-) )? |
@agentzh Thanks for your review :) |
@bungle Thanks, I tried to implement |
Wow, that is really nice! Good job. |
ebb8f5c
to
5b8387e
Compare
+1 |
++1 |
e7ac10c
to
cfd4f90
Compare
|
||
|
||
enum { | ||
SHDICT_USERDATA_INDEX = 1, | ||
}; | ||
|
||
|
||
#define ngx_http_lua_shdict_get_list_head(sd, key_len) \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall we use an inline function here instead of a macro? Thanks!
@doujiang24 Will you please rebase it to the latest master branch? Thanks! |
|
||
lua_pushnumber(L, (lua_Number) sd->value_len); | ||
|
||
ngx_shmtx_unlock(&ctx->shpool->mutex); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better put ngx_shmtx_unlock()
before lua_pushnumber()
because the latter might throw. Thanks!
|
||
p = ngx_copy(sd->data, key, key_len); | ||
ngx_memcpy(p, str_value_buf, str_value_len); | ||
} else if (rc == NGX_OK) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
�I don't think we need an else
here since the previous branch always jumps away via goto push_node
, right?
It seems to me that the |
@agentzh Thanks for your review :) |
@@ -1534,7 +2206,7 @@ ngx_http_lua_find_zone(u_char *name_data, size_t name_len) | |||
if (name->len == name_len | |||
&& ngx_strncmp(name->data, name_data, name_len) == 0) | |||
{ | |||
return &zone[i]; | |||
return zone; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm afraid this change is wrong and bad.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, this may be something wrong from rebase :(
I have rechecked the left change :)
Merged into master already. |
I'm not sure if it is an good idea to get the list queue head in the way:
Anything not suitable, let me know, thanks :)