In one project, the blogger used the Redis class in the tool class because the Redis did not encapsulate the pipeline pipeline and EXEC commands, so pen a __call.
The code is as follows (where $this->_connect () returns a Redis instance).
After the things feel Chinese can not be expressed, the code is similar to
$redis->pipeline ();
$redis->lpop ($key);
$redis->lpop ($key);
$redis->exec ();
After you have written a simple example test, you should normally return the top two stack elements in the $key queue, that is, array (' item1 ', ' item2 '), but the result of the final return is null.
Super doubt, is it call_user_fun_array () The function of this application is the return value of wood, and so on, that this is not the pit dead daddy. And this is just a person guess, PHP treasure Book in the hand is not empty, found that there is no such
Description, but there is a simple example of this: The following example, plus a personal test, is a return value, which means that this conjecture is unsuccessful.
OK, can only continue to debug, long after the wood has found problems, ask the company a colleague, he came to find you said that since it is $this->_connect () is a Redis object,
There is not a $this->_redis handle, direct replacement, and then in the magical thing happened, there is a return value.
Well, the question can be guessed twos, this certainly shows that $this->_connect () and $this->_redis there must be something different, such as the above code, we directly dump two variables.
It was then discovered that, as crossing should understand, this is fundamentally different two resources.
Feeling aware of the problem, returned to see the _connect () function, found that there is no Redis singleton, each time is a new Redis object.
So still do not know the problem is crossing can continue to follow elder brother go down.
This problem, we technical people do not say anything, on the code, in a batch of REDIS Operations Command, the use of three different Redis objects, the third is direct exec, even pipeline are wood, that is definitely null.
This you believe, anyway, I am a letter, I am also drunk, of course, I also pit myself. The problem comes to the truth. There was a strange way of playing in the pit.
A Redis usage bug record (EXEC)