<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                ## Redis專題一:數據類型 [TOC] > Redis是一種非關系型數據庫,使用key-value鍵值對存儲方式 > key-value可以是string, list, hashes, or ordered sets等數據類型 ### strings 存儲字符串,數值類型 | 命令 | 解釋 | 例子 | | --- | --- | --- | | `SET key value`| 存入key-value | `SET server:name "fido"`| | `GET key value`| 獲取指定key的value | `GET server:name ` <br> `=> "fido"`| | `EXISTS key`| 判斷是否存在key,1表示在,0表示不存在 | ` EXISTS server:name ` <br> `=> 1`| | `DEL key`| 刪除指定key | `DEL server:name`| | `INCR key`| 在指定key的value值上加上1,針對的是數值類型 |`SET connections 10` <br> `INCR connections ` <br> `=> 11`| | `INCRBY key step`| 在指定key的value值上加上step,針對的是數值類型 | `SET connections 1`<br> `INCRBY connections 100 ` <br> `=> 101`| | `DECR key`| 在指定key的value值上減上1,針對的是數值類型 |`SET connections 10` <br> `DECR connections` <br> ` => 9`| | `DECRBY key step`| 在指定key的value值上減上step,針對的是數值類型 | `SET connections 100`<br> `DECRBY connections 10` <br> ` => 90`| ### list 有序的列表,可以在列表頭和尾插入刪除元素 | 命令 | 解釋 | 例子 | | --- | --- | --- | | `RPUSH key value [value ...]`| 在列表尾部插入一個或多個新元素 | ` RPUSH friends "Alice"`<br> 或` RPUSH friends "Sam" "Alice"`| | `RPOP key `| 刪除列表尾部元素,并返回該元素 | ` RPOP friends` <br> ` => "Alice"`| | `LPUSH key value [value ...]`| 在列表頭部插入新元素 | ` LPUSH friends "Sam"`<br> 或` LPUSH friends "Sam"`| | `LPOP key `| 刪除列表頭部元素,并返回該元素 | ` LPOP friends` <br> ` => "Sam"`| | ` LLEN key `| 返回列表的長度| ` LLEN friends`| | `LRANGE key start end`| 返回列表的子集,-1代表最后一個元素 | ` LPUSH friends "Sam" "Alice" "Bob"`<br> ` LRANGE friends 0 -1`<br> ` =>` <br> ` 1) "Sam" ` <br> ` 2) "Alice" ` <br> `3) "Bob"`| ### sets 與list一樣,但是是無序且不重復的 | 命令 | 解釋 | 例子 | | --- | --- | --- | | `SADD key value [value ...]`| 向set中插入一個或多個新元素 | ` SADD superpowers "flight"`<br> 或 `SADD superpowers "x-ray vision" "reflexes"`| | `SREM key value `| 刪除指定key的value, 并返回1表示元素村在,返回0表示元素不存在 | ` SREM superpowers "reflexes" ` <br> `=> 1`| | `SISMEMBER key value`| 判斷set中是否存在value,1表示在,0表示不存在 | ` SISMEMBER superpowers "flight" ` <br> ` => 1`| | `SMEMBERS key `|返回set集中所有元素構成的列表 | ` SMEMBERS superpowers `<br> `=> ` <br> `1) "flight" ` <br> `2) "x-ray vision"`| | `SUNION key1 key2`| 對2個set做交集運算 | `SADD superpowers "x-ray vision"`<br>`SADD birdpowers "pecking"`<br>`SADD birdpowers "flight"`<br>`SUNION superpowers birdpowers`<br> `=> ` <br> ` 1) "pecking" ` <br> `2) "x-ray vision" ` <br> ` 3) "flight"`| | `SPOP key number`| 刪除number個元素,并返回被刪除的元素列表 | ` SADD letters a b c d e f`<br> `SPOP letters 2 ` <br> ` => ` <br> `1) "c" ` <br> ` 2) "a"`| ### sorted sets 與set一樣,但是是按照score排序的 | 命令 | 解釋 | 例子 | | --- | --- | --- | | `ZADD key score value`| 向set中插入指定score的新元素 |`ZADD hackers 1940 "Alan "`| | `ZADD key start end`| 獲取指定range的元素列表 |`ZADD hackers 1940 "Alan "`<br> `ZADD hackers 1906 "Grace "`<br> `ZADD hackers 1953 "Richard "`<br> `ZADD hackers 1965 "Yukihiro "`<br> ` ZADD hackers 1916 "Claude "`<br> ` ZADD hackers 1969 "Linus "`<br> ` ZADD hackers 1957 "Sophie "`<br> ` ZADD hackers 1912 "Alan "`<br> ` ZRANGE hackers 2 4`<br> ` => ` <br> `1) "Claude" ` <br> `2) "Alan" ` <br> `3) "Richard"`| ### Hashes 用于存儲包含多個成員字段的對象,如一個用戶包含名字、年齡、性別等 | 命令 | 解釋 | 例子 | | --- | --- | --- | | `HSET key field value`| 向對象的指定的一個字段賦值 |`HSET user:1001 name "John Smith"`| | `HMSET key field value [field value ...]`| 向對象的指定的多個字段賦值 |` HMSET user:1001 name "Mary Jones" age 20`| | `HGETALL key`| 返回對象 | ` HMSET user:1001 name "Mary Jones" age 20`<br> ` HGETALL user:1001`<br> `=> `<br> `1) "name" `<br> `2) "Mary Jones"` <br> `3) "age" `<br> `4) "20" ` | | `HGET key field`| 獲取對象指定字段的value值 |` HGET user:1001 name`<br> ` => "Mary Jones"`|
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看