简体   繁体   English

如何从具有不同密钥的redis数据库中一次获取100条记录?

[英]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.

相关问题 如何使用Jedis获取redis服务器的系统时间? - How can I get the system time of redis server by using Jedis? 如何通过 Spring 启动 Spring 数据从 redis 缓存中获取所有密钥? - How do I get all the keys from a redis cache via Spring Boot with Spring Data Redis 2.x? 如何通过Spring Boot从Redis缓存中获取所有密钥? - How do I get all the keys from a redis cache via Spring Boot? 如何从Redis缓存中获得定制的价值? - How can I get customized value from Redis cache? 如何从具有最快时间到当前时间的数据库中获取值? - How can I get a value from database that has the soonest time to current time? 如何从jsp页面删除数据库记录? - How can I delete database records from a jsp page? 如何从Firebase实时数据库中具有不同键的节点读取相同的值? - How to read same value from nodes with different keys in Firebase real-time database? 我如何从Android中的数组contentValue获取(键,值) - How can i get (keys,values) from an array contentvalue in android 如何从 LinkedHashMap 中获取具有“最佳”值的键 - How can I get the keys with the 'best' values from a LinkedHashMap 如何在 java 中创建具有 3 个表的记录的数据结构? - How can I create data structure in java having records from 3 tables?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM