Bạn nên sử dụng lệnh HSCAN.
Ví dụ:
redis> HMSET address_book bob_123456 Address1 mary_567894 Address2 john_123456 Address3
OK
redis> HSCAN address_book 0 match *_123456
1) "0"
2) 1) "bob_123456"
2) "Address1"
3) "john_123456"
4) "Address3"
Cập nhật
Triển khai Python:
r = Redis(....) #redis url
for address in r.hscan_iter('address_book', match='*_123456'):
print(address)