ITPub博客

首页 > 数据库 > NoSQL > redis操作之一

redis操作之一

原创 NoSQL 作者:hunterjoy 时间:2015-07-16 06:54:33 0 删除 编辑
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/,如需转载,请注明出处,否则将追究法律责任。

上一篇: Mysql杀进程
请登录后发表评论 登录
全部评论

注册时间:2007-12-31

  • 博文量
    156
  • 访问量
    352197