如何使用Rediska创建列表的新实例


How to create a new instance of a list using Rediska?

我想在Rediska中创建一个List的新实例,但它似乎总是想使用一些全局列表。

例如,以下是我用来创建新列表的代码:

  $firstList = new Rediska_Key_List('newList');
  $firstList[] = "firstList: first element";
  $firstList[] = "firstList: second element";
  $secondList = new Rediska_Key_List('newList');
  $secondList[] = "secondList: first element";
  $secondList[] = "secondList: second element";
  echo "$secondList[0] and $secondList[1]";

它将响应以下内容:firstList: first element and firstList: second element这可能是因为Rediska_Key_List的第一个参数同名。我不需要这个。我只想创建一个新的无名实例。我不能把第一个论点留空。我希望脚本打印以下内容:

`secondList: first element and secondList: second element`

谢谢!

如果您还不想将其存储在redis中,只需创建一个php表,然后在需要时将其复制到redis中。