commande redis HINCRBYFLOAT


  Résultats de traduction:

incr

abbr.increase (valeur, prix, inventaire, montant, production, etc.) augmentation ; ...; expression due à; après

adv passage; utilisé pour exprimer une courte visite

float

Anglais [fləʊt] US [floʊt]

vt.& vi. flotter; (faire) flotter; flotter librement

vi. errer

vt. dessiner pour considération; aller en public flotter; floats Pluriel : floats Participe présent : flottant Passé : floated Participe passé : floated

commande redis HINCRBYFLOATsyntaxe

Fonction : Ajoutez un incrément à virgule flottante au champ dans la clé de la table de hachage.

Syntaxe : Incrément du champ clé HINCRBYFLOAT

Explication : S'il n'y a pas de champ de champ dans la table de hachage, alors HINCRBYFLOAT définira d'abord la valeur du champ de champ à 0 avant d'effectuer l'opération d'ajout. Si la clé clé n'existe pas, alors HINCRBYFLOAT créera d'abord une table de hachage, puis créera le champ champ et enfin effectuera l'opération d'ajout.

Versions disponibles : >= 2.6.0

Complexité temporelle : O(1)

Retour : La valeur du champ après avoir effectué l'opération d'addition.

commande redis HINCRBYFLOATexemple

# 值和增量都是普通小数
redis> HSET mykey field 10.50
(integer) 1
redis> HINCRBYFLOAT mykey field 0.1
"10.6"
# 值和增量都是指数符号
redis> HSET mykey field 5.0e3
(integer) 0
redis> HINCRBYFLOAT mykey field 2.0e2
"5200"
# 对不存在的键执行 HINCRBYFLOAT
redis> EXISTS price
(integer) 0
redis> HINCRBYFLOAT price milk 3.5
"3.5"
redis> HGETALL price
1) "milk"
2) "3.5"
# 对不存在的域进行 HINCRBYFLOAT
redis> HGETALL price
1) "milk"
2) "3.5"
redis> HINCRBYFLOAT price coffee 4.5   # 新增 coffee 域
"4.5"
redis> HGETALL price
1) "milk"
2) "3.5"
3) "coffee"
4) "4.5"

Maison

vidéos

Questions et réponses