1

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: 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!

egidra
  • 347
  • 2
  • 9
  • 18
  • Have you tried changing the second `newList` to something else? Somewhat a silly question, but I'm just curious. – hakre Jun 29 '11 at 21:56
  • I have, but it doesn't help me the way that I am trying to use it. I have a class that interacts with redis. It creates a list that contains two elements, a value and a time. I want this list to be the value of a key. This pair will belong in a hashmap. It's hard to explain, but I can only use an instance of a list because I want to add it as the value of a key later. I do not want to add it to redis yet. – egidra Jun 29 '11 at 22:03

1 Answers1

0

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

crazyjul
  • 2,519
  • 19
  • 26