예제 #1
0
            $i = 0;
            foreach ($userlist as $index => $uid) {
                $local_pipeline->sCard($uid . '-3dim');
                if ($i % 10000 == 0) {
                    echo '*';
                }
                $i++;
            }
            $tempArray = $local_pipeline->exec();
            $pipeline = $redis->pipeline();
            $local_pipeline = $local_redis->pipeline();
            $i = 0;
            foreach ($userlist as $index => $uid) {
                $pipeline->zAdd('rank-3', $tempArray[$index], $uid);
                //free memory
                $local_pipeline->del($uid . '-3dim');
                if ($i % 10000 == 0) {
                    echo '.';
                }
                $i++;
            }
            $pipeline->exec();
            $local_pipeline->exec();
        }
        $local_redis->close();
        $redis->close();
    }
}
$rank = new Rank();
$rank->run();