Redis › Hashes in Redis
How do you retrieve only the field names or only the values from a Redis hash, without needing both together?
IntermediateAnswer
You use HKEYS to retrieve just the list of field names currently stored in a hash, and HVALS to retrieve just the list of corresponding values, which can be useful when you only need one or the other rather than the complete set of field value pairs that HGETALL would return.
HKEYS user:100
HVALS user:100Real-world example A data export tool uses HKEYS to first discover what fields exist across different user hashes with varying schemas, before deciding which specific fields to actually extract and include in its export.