开发者

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

I want to create a new instance of a List in Rediska, but it seems to always want to use some global list.

For example, here is the code that I am using to create a new 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]";

It will echo the following: firstList: 开发者_JAVA百科first element and firstList: second element Presumably, this is because the first argument of the Rediska_Key_List is the same name. I do not need this. I just want to create a new nameless instance. I cannot leave the first argument blank. I would like the script to print the following:

`secondList: first element and secondList: second element`

Thanks!


If you don't want to store it in redis yet, just create a php table, and afterward copy it to redis when needed

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜