[英]How can i get 100 records at a time from redis database having different keys?
There are different keys inserted into redis database.I want to process that data using multithreading.But all threads will peek same data as there is no flag to update in redis database. Redis数据库中插入了不同的键,我想使用多线程处理该数据,但是所有线程都将窥探相同的数据,因为Redis数据库中没有要更新的标志。
There are 10000 data in redis database but how can pick only 1000 data out of it if i don't know the keys; Redis数据库中有10000个数据,但是如果我不知道键,怎么能从中选择1000个数据;
I recommend to use a set (or sorted set) to process your queue. 我建议使用一个集合(或排序集合)来处理您的队列。 The population can be done with: http://redis.io/commands/sadd To remove your values, each worker can use: http://redis.io/commands/spop Hope it helps!
可以使用以下命令完成填充: http : //redis.io/commands/sadd要删除您的值,每个工作人员都可以使用: http : //redis.io/commands/spop希望能有所帮助!
You can use Hash or sorted set to store keys. 您可以使用哈希或排序集来存储密钥。 To iterate over hash or sorted set use hscan or zscan with count = 1000
要遍历哈希或排序集,请使用hscan或zscan,其count = 1000
http://redis.io/commands/scan read here http://redis.io/commands/scan 在此处阅读
hopes it helps 希望能有所帮助
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.