"Redis hash Operation "
1.hset key field value
Sets in the field hash stored on key to value . If key does not exist, a new key holding a hash is created. If field already exists in the hash, it's overwritten.
Return value
Integer reply, specifically:
1If is field a new field in the hash and was value set.
0If field already exists in the hash and the value is updated.
2.hexists key field
Returns if is a field existing field in the hash stored at key .
Return value
Integer reply, specifically:
1If the hash contains field .
0If the hash does not contain field , or key does not exist.
3.hget key field
Returns the value associated with the field hash stored at key .
Return value
Bulk string reply:the value associated field with, or when was not present in the nil field hash or key does not exist .
4.Hdel key field [field ...]
Removes the specified fields from the hash stored at key . Specified fields and does not exist within this hash is ignored. If key does not exist, it is treated as a empty hash and this command returns 0 .
Return value
The Integer reply:the number of fields this were removed from the hash, not including specified but non existing fields.
5.Hkeys Key
Returns all field names in the hash stored key .
Return value
Array reply:list of fields in the hash, or an empty list when key does not exist.
6.hvals Key
Returns all values in the hash stored key .
Return value
Array reply:list of values in the hash, or a empty list when key does not exist.
7.Hgetall Key
Returns all fields and values of the hash stored at key . In the returned value, every field name was followed by it value, so the length of the reply is twice the size of the hash .
Return value
Array reply:list of fields and their values stored in the hash, or a empty list when key does not exist.
8.Hlen Key
Returns the number of fields contained in the hash stored at key .
Return value
Integer Reply:number of In the the hash, or 0 when key does not exist.
9.hmset key field value [Field value ...]
Sets the specified fields to their respective values in the hash stored at key . This command overwrites any existing the hash. If key does not exist, a new key holding a hash is created.
Redis Hash Operations