标签:
EXISTS mykey 0 APPEND mykey "Hello" 5 APPEND mykey " world" 11 GET mykey Hello world
SETBIT bit 10086 1 0 SETBIT bit 10086 1 1 GETBIT bit 10086 1 GETBIT bit 100 0
BITCOUNT bits 0 SETBIT bits 0 1 0 BITCOUNT bits 1 SETBIT bits 3 1 0 BITCOUNT bits 2
SETBIT peter 101 1
EXISTS bit 0 GETBIT bit 10086 0 SETBIT bit 4 1 0 GETBIT bit 4 1
SET num 10 OK DECR num 9 EXISTS count 0 DECR count -1
SET count 10 OK DECRBY count 20 -10 EXISTS pages 0 DECRBY pages 1 -1 DECRBY pages -1 0 DECRBY pages -3 3
GET db SET DB redis OK get DB redis DEL db 0 EXISTS db 0 LPUSH db redis mongodb mysql 3 GET db ERR Operation against a key holding the wrong kind of value
SET greeting "Hello,my friend" OK GETRANGE greeting 0 4 Hello GETRANGE greeting -1 -5 GETRANGE greeting -3 -1 end GETRANGE greeting 0 -1 Hello,my friend GETRANGE greeting 0 10000000 Hello,my friend
GETSET db mongodb GET db mongodb GETSET db redis mongodb
INCR mycount 1 INCR mycount 2 INCR mycount 3 GETSET mycount 0 3
SET page_view 20 OK INCR page_view 21
SET rank 50 OK INCRBY rank 20 70 GET rank 70 SET book "REDIS" OK INCRBY book 1 ERR value is not an integer or out of range
SET mykey 10.50 OK INCRBYFLOAT mykey 0.1 10.6 SET mykey 314e-2 OK INCRBYFLOAT mykey 0.5 3.64 SET mykey 4 OK INCRBYFLOAT mykey 0.5 4.5
SET redis redis.com OK SET mongodb mongodb.com OK MGET redis mongodb mysql redis.com mongodb.com
MSET date "2012-05" time "11:00 am" weather "SUNNY" OK MGET date time weather 2012-05 11:00 am SUNNY SET google "google.hk" OK MSET google "google.com" OK GET google google.com
MSETNX rmdbs "MySql" nosql "MongoDB" key-value-store "Redis" 1 MGET rmdbs nosql MySql MongoDB MSETNX rmdbs "MySql" language "Java" 0
PSETEX mykey 10000 "HELLO" OK PTTL mykey 7110 GET mykey HELLO PTTL mykey -1 GET mykey
SETkey
value PXmillisecond
效果等同于
PSETEX
key millisecondvalue。
SET key "value" OK GET key value SET key "new-value" OK get key new-value SET key "hello" EX 100860 OK TTL key 100856 TTL key 100852 SET key "moto" PX 123331 OK TTL key 121 get key moto TTL key 107 SET key "value" NX SET key1 "value" NX OK SET key "value" XX OK SET key2 "value" XX
SETEX user_id 60 10086 OK TTL user_id 54 get user_id 10086 get user_id 10086 TTL user_id 36
EXISTS job 0 SETNX job "code-farmer" 1 SETNX job "programmer" 0 GET job code-farmer
redis> SET greeting "hello world" OK redis> SETRANGE greeting 6 "Redis" (integer) 11 redis> GET greeting "hello Redis" # 对空字符串/不存在的 key 进行 SETRANGE redis> EXISTS empty_string (integer) 0 redis> SETRANGE empty_string 5 "Redis!" # 对不存在的 key 使用 SETRANGE (integer) 11 redis> GET empty_string # 空白处被"\x00"填充 "\x00\x00\x00\x00\x00Redis!"
SET mykey "Hello World" OK STRLEN mykey 11 STRLEN nonestr 0
标签:
原文地址:http://blog.csdn.net/mergades/article/details/46425915