zoukankan      html  css  js  c++  java
  • Redis

    String:

      set str abc设置值

      get str 获取值

      del str 删除值

    Hash:

      hset hash1 filed1 1 设置值 

      hget hash1 filed1 获取值

      hset hash1 filed2 2,hset hash1 filed3 3 hash1中可以添加多个

      hkeys hash1查看hash1所有key

      hvals hash1 查询hash1所有值

      hgetall hash1 查看所有

      hdel hash1 filed3 删除hash1中filed3

    List(有序):

      lpush list1 1 2 3 4 5 6 向左边添加(第一个数为6)

      rpush list1 a b c d 向右边添加(最后一个为d)

      lrange list 0 -1 从起始元素到最后元素显示

      lpop list1 从左取出元素(取完list1中就没有了)

      rpop list1 从右边取出元素

    Set(无序,无重复数据):

      sadd set1 a b c d 添加

      srem set1 a 删除

      smembers set1 显示

      sadd seta a b c d 

      sadd setb b c d e

      sdiff seta setb 取seta与setb的差集 结果 a

      sdiff setb seta 取setb与seta的差集 结果 e

      sinter seta setb 取交集 结果 b c d

      sunion seta setb 取并集 结果 a b c d e

    SortedSet(有序,无重复数据):

      zadd zset1 1 a 3 b 2 c 4 d 添加元素(1为加入的顺序)

      zrange zset1 0 -1 查看元素

      zrem zset1 a 删除元素

      zrevrange zset1 降序排列

      zrevrange zset1 withscores 把顺序号也显示

      

    设置key过期时间:

      expire str 100 设置str过期时间为100s

      ttl str 查看过期时间,负数为持久化

      persist str清除过期时间

      

    redis客户端:redis-desktop-manager-0.8.8.384.exe

      

      

  • 相关阅读:
    centos8.0 安装 jenkins
    No match for argument: mysql-community-server Error: Unable to find a match: mysql-community-server
    Navicat 远程连接 centos8.0
    centos8.0 安装 mysql
    -bash: java-version: command not found
    centos8.0 安装 JDK1.8
    [Err] 1062
    android之Fragment基础详解(一)
    Android之RecyclerView(一)
    Android之ProgressBar
  • 原文地址:https://www.cnblogs.com/zhoucx66/p/9274580.html
Copyright © 2011-2022 走看看