如何在redis中搜索HGETALL响应中的密钥


127.0.0.1:6379> hgetall "box_vehicle_mapping"
1) "A9AC"
2) "{"box_version": "v8_3zo", "box_sub_version": "8", "box_number": "A9AC", "box_usage_type": "vehicle", "version": 8, "current_state": 2, "registration_number": ["KA-03-AE-0017"]}"
3) "A99V"
4) "{"registration_number": "KA-05-AH-8889", "box_version": "v8_3zo"}"
5) "A9A3"
6) "{"box_version": "v8_3zo", "box_sub_version": 17, "box_number": "A9A3", "box_usage_type": "vehicle", "version": 8, "current_state": 2, "registration_number": ["KA-03-AE-0016"]}"
7) "A9AD"
8) "{"box_version": "v8_3zo", "box_sub_version": "12", "box_number": "A9AD", "box_usage_type": "vehicle", "version": 8, "current_state": 2, "registration_number": ["KA-03-AE-0021"]}"
127.0.0.1:6379>

我怎么能对它进行搜索,说我想知道是否";A99V";密钥是否存在于hgetall密钥的结果中?

如果只关心现有的一个键,只需使用HEXISTS,或者使用HGET即可获得一个值。

HGET box_vehicle_mapping A99V

最新更新