1. Redis years, list are ordered (by order of addition), set are unordered
RPUSH key value. This is the right place, to whoever, who more high ranking, can be used to simulate a high concurrent to grab votes
If 100 people are competing for 80 votes, at the same time insert, take (votes, 0, 79) if the person on the inside, then it is to grab votes success. If not, then there is no success.
Jedis jedis = new Jedis("localhost");
List<String> ss=jedis.lrange( "apache", 0, -1 );
if (
ss.contains("mosk")
) {
System.out.println ( "comprises MOSK!");
}
The else {
System.out.println ( "does not include MOSK!");
}
This code may be attached to all elements Redis acquired key "apache" of the list, if the acquired just 10, the line 9 into -1.
- This method can be used to determine