Quantcast
Channel: Active questions tagged redis+java - Stack Overflow
Viewing all articles
Browse latest Browse all 2204

Java: Can I use Redis db to create Priority queues and the priority is set according to the value of the key in the data set

$
0
0

I am new to Redis. I want to use priority queues in Redis via Java client. I will have a set of key value pairs. And use this as a priority queue.

The data set contains keys and its corresponding values. example [a:1,b:1,c:1]. The value field will represent the number of times the key is present in the data set. If another key "a" is inserted into the data set, then it becomes [a:2,b:1,c:1].

Here comes the priority. The most of keys present in the set will be of highest priority, in the example its [a], and it should be at the top of the queue. So when I pop the queue, the element with highest priority should pop out.

Also if the data set looks like this [a:2,b:2,c:2], then I want to pick the random one to pop out of the queue.

Since my data set will be of key, value pair I want to use Redis[you may suggest a better one].


Viewing all articles
Browse latest Browse all 2204

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>