search

Home  >  Q&A  >  body text

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 days ago791

reply all(1)I'll reply

  • 習慣沉默

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

    Set is unordered by definition. No matter how the program is saved, you should not believe that it can give you the original order. If you want order, use List.

    reply
    0
  • Cancelreply