redis hash操作

redis 127.0.0.1:6379[1]> hset article browser_count 1

(integer) 1

redis 127.0.0.1:6379[1]> hget article browser_count 

"1"

redis 127.0.0.1:6379[1]> type article

hash

redis 127.0.0.1:6379[1]> hmset article browser_count 2 revert_count 1

OK

redis 127.0.0.1:6379[1]> hmget article browser_count revert_count

1) "2"

2) "1"

redis 127.0.0.1:6379[1]> hgetall article

1) "browser_count"

2) "2"

3) "revert_count"

4) "1"

redis 127.0.0.1:6379[1]> hlen article

(integer) 2

redis 127.0.0.1:6379[1]> hdel article revert_count1

(integer) 0

redis 127.0.0.1:6379[1]> hdel article revert_count 

(integer) 1

redis 127.0.0.1:6379[1]> hgetall article

1) "browser_count"

2) "2"

redis 127.0.0.1:6379[1]> hexists article revert_count

(integer) 0

redis 127.0.0.1:6379[1]> hexists article browser_count

(integer) 1

redis 127.0.0.1:6379[1]> hincrby article browser_count 2

(integer) 4

redis 127.0.0.1:6379[1]> hgetall article

1) "browser_count"

2) "4"

redis 127.0.0.1:6379[1]> hkeys article

1) "browser_count"

redis 127.0.0.1:6379[1]> hvals article

1) "4"

redis 127.0.0.1:6379[1]> quit

你可能感兴趣的:(redis,redis-cli,hset,hdel,hget)