redis操作之一

hunterjoy發表於2015-07-16
redis 127.0.0.1:6379> ping
PONG
redis 127.0.0.1:6379> SET name "linfy"
OK
redis 127.0.0.1:6379> GET name
"linfy"
redis 127.0.0.1:6379> HMSET user:1 username linfy password linfy points 200
OK
redis 127.0.0.1:6379> HGETALL user:1
1) "username"
2) "linfy"
3) "password"
4) "linfy"
5) "points"
6) "200"
redis 127.0.0.1:6379> lpush tutoriallist redis
(integer) 1
redis 127.0.0.1:6379> lpush tutoriallist mongodb
(integer) 2
redis 127.0.0.1:6379> lpush tutoriallist rabitmq
(integer) 3
redis 127.0.0.1:6379> lrange tutoriallist 0 10
1) "rabitmq"
2) "mongodb"
3) "redis"
redis 127.0.0.1:6379> sadd tutoriallist redis
(error) ERR Operation against a key holding the wrong kind of value
redis 127.0.0.1:6379> sadd tutoriallist mongodb
(error) ERR Operation against a key holding the wrong kind of value
redis 127.0.0.1:6379> sadd linfylist redis
(integer) 1
redis 127.0.0.1:6379> sadd linfylist mongodb
(integer) 1
redis 127.0.0.1:6379> sadd linfylist rabitmq
(integer) 1
redis 127.0.0.1:6379> sadd linfylist rabitmq
(integer) 0
redis 127.0.0.1:6379> smembers linfylist
1) "mongodb"
2) "rabitmq"
3) "redis"
redis 127.0.0.1:6379> zadd tianlist 0 redis
(integer) 1
redis 127.0.0.1:6379> zadd tianlist 0 mongodb
(integer) 1
redis 127.0.0.1:6379> zadd tianlist 0 memcached
(integer) 1
redis 127.0.0.1:6379> zadd tianlist 0 memcached
(integer) 0
redis 127.0.0.1:6379> zrangebyscore tianlist 0 1000
1) "memcached"
2) "mongodb"
3) "redis"
redis 127.0.0.1:6379> command key_name
(error) ERR unknown command 'command'
redis 127.0.0.1:6379> COMMAND KEY_NAME
(error) ERR unknown command 'COMMAND'
redis 127.0.0.1:6379> SET linfy redis
OK
redis 127.0.0.1:6379> DEL linfy
(integer) 1
redis 127.0.0.1:6379> SET dou redis
OK
redis 127.0.0.1:6379> get dou
"redis"
redis 127.0.0.1:6379> edis basic commands for caching" likes 20 visitors 23000
(error) ERR Operation against a key holding the wrong kind of value
redis 127.0.0.1:6379> HMSET doudou name "redis tutorial" description "redis bas
OK
redis 127.0.0.1:6379> HGETALL doudou
1) "name"
2) "redis tutorial"
3) "description"
4) "redis basic commands for caching"
5) "likes"
6) "20"
7) "visitors"
8) "23000"
redis 127.0.0.1:6379>quit








來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/543979/viewspace-1734665/,如需轉載,請註明出處,否則將追究法律責任。

相關文章