my application is set "session_handler" to Redis in php.ini,when I write the following code, Redis session storage is nil. My initial idea is a method to deal with time-consuming tasks and write current progressing value into the session variable, another method by ajax polling task progress.
session_start();
$i = 1;
while ($i <= 10)
{
$_SESSION['process_sync'] = $i;
$i++;
sleep(1);
}
$msg = "processing is over";
session_destroy();
print $msg;
I do not know if sleep time is too long, Redis connection will be closed, but 1 second should not be a long time. Or $ _SESSION = "fang xing" assignment, Redis client did not immediately send orders to the Redis server, but in the queue cache, in other words this operation is not blocked, followed by the implementation of sleep, Redis client will put the above Said the queue data discarded? (I assume)
Who can give me talk about the principle :)