Jedis explains the five types of operation codes of redis in detail

This article mainly describes jedis's five types of operations on redis: string, list, hash, set and ordered set.

JedisUtil

The test cases here are run with junit4, and the preparation code is as follows:

Jedisutil is a simple encapsulation of jedis. The code is as follows:

Key operation

Output results:

String operation

In redis, strings can store three types of values:

Byte string integer floating point number section string

Output results:

Memcached and redis have the same append operation, but memcached has the prepend operation, which is not available in redis.

Integers and floating point numbers

Output results:

On redis2 Version 6 or above has this command: incrbyfloat, that is, the value stored in the key plus the floating point number amount, jedis-2.1 This operation is not supported in 0.

list

Output results:

Redis also has blocking list pop-up commands and commands to move elements between lists: blpop, brpop, rpolpush, brpoplpush, etc.

Set

Output results:

There are other commands about set: srandmember, sdiffstore, sinterstore, sunionstore, etc.

hash

Output results:

Ordered set

Output results:

Ordered sets also have commands such as zinterstore, zunionstore, zremrangebyscore, zremrangebyrank, zrevrank, zrevrange, zrangebyscore, and so on.

Sort sort

Output results:

summary

The above is all about the detailed explanation of jedis's five operation codes for redis in this article. I hope it will be helpful to you. Interested friends can continue to refer to this website:

Redis implementation counter - Introduction to the method of preventing bill swiping

Master slave synchronization resolution of redis

Java programming redisson implementation of distributed lock code example

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>