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

hexists 和 hkeys 需要完善 #41

Closed
moolex opened this issue Jun 1, 2013 · 4 comments
Closed

hexists 和 hkeys 需要完善 #41

moolex opened this issue Jun 1, 2013 · 4 comments

Comments

@moolex
Copy link

moolex commented Jun 1, 2013

1、hexists 函数只能判断hash表是否存在,不能判断表中是否存在某个key
2、hkeys 函数只有limit,不支持start,大数据量分页的效果无法实现

@ideawu
Copy link
Owner

ideawu commented Jun 1, 2013

@moolex 你好, hkeys 支持分页, 参数为 hkeys($name, $key_start, $key_end, $limit). 如果需要判断表中是否存在某个key, 目前可以使用multi_hget, 未来会增加方法.

@moolex
Copy link
Author

moolex commented Jun 3, 2013

关于hkeys的接口意义,我在实验中发现是这样的:

比如我有3个key值,a1,b2,c3

如果我想搜索出来b2,我就要用 hkeys(name, 'a', 'c', 1);

我的需求是按照key值的prefix来进行检索,发现只能对这个prefix的最后一位字符进行ASCII-1作为key_start,ASCII+1作为key_end,然后那个limit只能作为一次获取限制,不能用作分页了。

我总是觉得我这个使用方法不太对劲,但也没看到详细的说明文档,所以想请教下正确的使用方法是什么呢?谢谢

@ideawu
Copy link
Owner

ideawu commented Jun 3, 2013

hi, ssdb数据集合的分页是游标分页, 和数据库的limit start, size, 不一样. 假设数据列表为:

a, b, c, d, e, f, g

想分页, 每页2条记录. 那么第一页 hkeys h "" "" 2, 返回

a, b

然后下一页, hkeys h b "" 2

@moolex
Copy link
Author

moolex commented Jun 3, 2013

喔,原来是这样,我明白了。谢谢解答,希望SSDB可以越做越好!

@moolex moolex closed this as completed Jun 3, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants