搜尋

首頁  >  問答  >  主體

redis新增資料不是加在原始資料的後面?

這是redis中原有的數據:

 1) "url:/doi/10.1002/anie.201601258/full"
 2) "url:/doi/10.1002/anie.201601883/full"
 3) "url:/doi/10.1002/anie.201600911/full"
 4) "url:/doi/10.1002/anie.201509978/full"
 5) "url:/doi/10.1002/anie.201601016/full"
 6) "url:/doi/10.1002/anie.201600841/full"
 7) "url:/doi/10.1002/anie.201511733/full"
 8) "url:/doi/10.1002/anie.201600918/full"
 9) "url:/doi/10.1002/anie.201601042/full"
10) "url:/doi/10.1002/anie.201601120/full"
11) "url:/doi/10.1002/anie.201602071/full"
12) "url:/doi/10.1002/anie.201509601/full"
13) "url:/doi/10.1002/anie.201511065/full"
14) "url:/doi/10.1002/anie.201601238/full"
15) "url:/doi/10.1002/anie.201510994/full"
16) "url:/doi/10.1002/anie.201601082/full"
17) "url:/doi/10.1002/anie.201509260/full"
18) "url:/doi/10.1002/anie.201601621/full"
19) "url:/doi/10.1002/anie.201510748/full"
20) "url:/doi/10.1002/anie.201601003/full"

Redis.set了三條數據,如下:

     1) "url:/doi/10.1002/anie.201601258/full"
 2) "url:/doi/10.1002/anie.201601883/full"
 3) "url:/doi/10.1002/anie.201600911/full"
 4) "url:http://www.peintopython.net/"
 5) "url:/doi/10.1002/anie.201509978/full"
 6) "url:http://www.brpreiss.com/books/opus7/html/book.html"
 7) "url:/doi/10.1002/anie.201601016/full"
 8) "url:/doi/10.1002/anie.201600841/full"
 9) "url:/doi/10.1002/anie.201511733/full"
10) "url:/doi/10.1002/anie.201600918/full"
11) "url:/doi/10.1002/anie.201601042/full"
12) "url:/doi/10.1002/anie.201601120/full"
13) "url:/doi/10.1002/anie.201602071/full"
14) "url:/doi/10.1002/anie.201509601/full"
15) "url:http://www.pearsonhighered.com/educator/academic/product/0,,0130260363,00%2Ben-USS_01DBC.html"
16) "url:/doi/10.1002/anie.201511065/full"
17) "url:/doi/10.1002/anie.201601238/full"
18) "url:/doi/10.1002/anie.201510994/full"
19) "url:/doi/10.1002/anie.201601082/full"
20) "url:/doi/10.1002/anie.201509260/full"
21) "url:/doi/10.1002/anie.201601621/full"
22) "url:/doi/10.1002/anie.201510748/full"
23) "url:/doi/10.1002/anie.201601003/full"

但是穿插在裡面,為什麼?
剛學redis,請教。

PHP中文网PHP中文网2795 天前795

全部回覆(1)我來回復

  • 習慣沉默

    習慣沉默2017-04-24 16:02:24

    Set是本身定義就是無序的,不管程式怎麼存,你都不要相信它能給你原有的順序。如果要有序,要用List。

    回覆
    0
  • 取消回覆