美文网首页
Redis基础命令

Redis基础命令

作者: 胖嘟嘟洒酒疯 | 来源:发表于2019-01-29 20:05 被阅读0次

    为了不让注释限制了你思考,所以我没写注释。。。。

    redis远程登陆命令
    redis-cli -h 47.100.246.144 -p 6379
    远程登陆前需要修改配置文件
    #bind 127.0.0.1
    protected-mode no
    

    Key:
    exists key
    del key
    type key
    renamenx key newkey
    move key db
    keys pattern
    expire key seconds
    pexpire key milliseconds
    persist key

    String:
    set key value
    setnx key value
    setec key seconds value
    setrange key offset value
    mset key value [key value]
    msetnx key value [key value]

    get key
    getset key value
    getbit key offset
    mget key [key]
    getrange key start end

    strlen key

    incr key
    incrby key increment
    incrbyfloat key increment
    decr key
    decrby key decrement

    append key value

    Hash:
    hset key field value
    hsetnx key field value
    hmset key field value [field value]

    hget key field
    hmget key field [field]
    hgetall key

    hdel key field [field]

    hexists key field
    hlen key
    hkeys key
    hvals key

    hincrby key field increment
    hincrbyfloat key field increment

    Set:

    sadd key member [member]

    smembers key

    srem key member [member]

    sismember key member
    scard key
    sdiffstore destination key key
    sdiff key key
    sinter key key
    sinterstore destination key key
    sunion key key
    sunionstore destination key key

    spop key 移除并返回一个随机元素

    List:
    lpush key value [value]
    lpushx key value
    rpush key value [value]
    rpushx key value
    lset key index value

    lindex key index
    lrange key start stop

    lpop key
    rpop key
    lrem key count value

    llen key

    Sort Set:
    zadd key score member [score member]

    zrange key start stop [withscores] 索引区间内成员
    zrangebylex key min max [limit offset count] 字典区间内成员
    zrangebyscore key min max [withscores] [limit] 分数区间内成员
    zrevrange key start stop [withscores] 索引区间内成员 分数高到低
    zrevrangebyscore key max min [withscores] 分数区间内成员 分数高到低

    zrem key member [member]
    zremrangebyrank key start stop
    zremrangebyscore key min max

    zcard key
    zcount key min max 指定分数区间的成员数
    zincrby key increment member 成员分数增量
    zlexcount key min max 字典区间内成员数量

    zrank key member 成员索引
    zrevrange key member 返回排名,分数高->低
    zscore key member 成员分值

    Publish:
    publish channel message
    subscribe channel [channel]
    unsubscribe channel [channel]

    Transactional:
    multi
    exec
    discard
    watch key [key]
    unwatch

    Scripts:
    eval script numkeys key [key ...] arg [arg ...]
    evalsha sha numkeys key [key ...] arg [arg ...]

    script load script
    script exists script [script]
    script flush

    script kill

    Connect:
    auth password
    echo message
    ping
    quit
    select index

    Server:
    bgrewriteaop
    bgsave
    client kill [ip:port] [id client-id]
    client list
    client getname
    client pause timeout
    client setname connection-name
    time
    config get parame
    dbsize
    flushall
    flushdb
    monitor
    lastsave
    save
    slaveof host post
    sync

    相关文章

      网友评论

          本文标题:Redis基础命令

          本文链接:https://www.haomeiwen.com/subject/exkfsqtx.html