答案 0 :(得分:4)
关于此:http://redis.io/topics/data-types
列表的最大长度为2 ^ 32 - 1个元素(4294967295,每个列表超过40亿个元素)。
我打赌你也可以同时使用这个数量的论点,但也许你会和你的客户发生超时。
当你的问题是关于表现时,我想这很好读/知道。
22:15 $ echo lpush works {1..1038} | redis-cli
(integer) 1038
✔ ~
22:15 $ echo lpush worksnot {1..1039} | redis-cli
(integer) 1038
(error) ERR unknown command '1039'
(error) ERR unknown command '1039'
(error) ERR unknown command '1039'
(error) ERR unknown command '1039'
(error) ERR unknown command '1039'
(error) ERR unknown command '1039'
(error) ERR unknown command '1039'
(error) ERR unknown command '1039'
(error) ERR unknown command '1039'
(error) ERR unknown command '1039'
(error) ERR unknown command '1039'
(error) ERR unknown command '1039'
(error) ERR unknown command '1039'
(error) ERR unknown command '1039'
(error) ERR unknown command '1039'
(error) ERR unknown command '1039'
(error) ERR unknown command '1039'
(error) ERR unknown command '1039'
(error) ERR unknown command '1039'
(error) ERR unknown command '1039'
(error) ERR unknown command '1039'
(error) ERR unknown command '1039'
(error) ERR unknown command '1039'
(error) ERR unknown command '1039'
(error) ERR unknown command '1039'
(error) ERR unknown command '1039'
(error) ERR unknown command '1039'
(error) ERR unknown command '1039'
(error) ERR unknown command '1039'
(error) ERR unknown command '1039'
(error) ERR unknown command '1039'
(error) ERR unknown command '1039'
(error) ERR unknown command '1039'
(error) ERR unknown command '1039'
(error) ERR unknown command '1039'
(error) ERR unknown command '1039'
(error) ERR unknown command '1039'
(error) ERR unknown command '1039'
✔ ~
22:15 $ redis-cli
127.0.0.1:6379> llen works
(integer) 1038
127.0.0.1:6379> llen worksnot
(integer) 1038
127.0.0.1:6379> llen worksnot
所以看起来限制是1038.
> args = {'lpush', 'mylist'}
> for n = 1,100000 do
>> table.insert(args, tostring(n))
>> end
>
> resp = require("resp")
> client = resp.new("127.0.0.1", 6379)
> client:call(unpack(args))
100000
> client:call('llen', 'mylist')
100000
lk可以100k罚款。 1米太多了。由于最大堆栈大小(猜测),lua(不是redis!)会遇到stdin:1: too many results to unpack
。
我仍然打赌你可以一次推送列表的最大长度......以防你的环境(编程语言,物理内存大小......)可以处理它。