当前位置:首页 > 开发 > 数据库 > 正文

redis string操作

发表于: 2013-07-22   作者:晨必须的   来源:转载   浏览:
摘要: redis 127.0.0.1:6379[1]> keys * 1) "caches" redis 127.0.0.1:6379[1]> get caches "ehcache" redis 127.0.0.1:6379[1]> set caches newCache OK redis 127.0.0.1:6379[1]>

redis 127.0.0.1:6379[1]> keys *

1) "caches"

redis 127.0.0.1:6379[1]> get caches

"ehcache"

redis 127.0.0.1:6379[1]> set caches newCache

OK

redis 127.0.0.1:6379[1]> get caches

"newCache"

redis 127.0.0.1:6379[1]> setnx caches newCache

(integer) 0

redis 127.0.0.1:6379[1]> get caches

"newCache"

redis 127.0.0.1:6379[1]> setnx caches cache

(integer) 0

redis 127.0.0.1:6379[1]> get caches

"newCache"

redis 127.0.0.1:6379[1]> mset date "2013-07-22" time "16:00" 

OK

redis 127.0.0.1:6379[1]> mget date time 

1) "2013-07-22"

2) "16:00"

redis 127.0.0.1:6379[1]> append time ":00"

(integer) 8

redis 127.0.0.1:6379[1]> get time

"16:00:00"

redis 127.0.0.1:6379[1]> getset time "15:00:00"

"16:00:00"

redis 127.0.0.1:6379[1]> strlen time

(integer) 8

redis 127.0.0.1:6379[1]> set age 22

OK

redis 127.0.0.1:6379[1]> decr age

(integer) 21

redis 127.0.0.1:6379[1]> decr age

(integer) 20

redis 127.0.0.1:6379[1]> decrby age 2

(integer) 18

redis 127.0.0.1:6379[1]> incr age

(integer) 19

redis 127.0.0.1:6379[1]> incrby age 2

(integer) 21

redis 127.0.0.1:6379[1]> quit

redis string操作

  • 0

    开心

    开心

  • 0

    板砖

    板砖

  • 0

    感动

    感动

  • 0

    有用

    有用

  • 0

    疑问

    疑问

  • 0

    难过

    难过

  • 0

    无聊

    无聊

  • 0

    震惊

    震惊

版权所有 IT知识库 CopyRight © 2009-2015 IT知识库 IT610.com , All Rights Reserved. 京ICP备09083238号