Exemple #1
0
 public function queueObject($object)
 {
     global $redis;
     $wrapped = serialize($object);
     $allQueues = new RedisTtlSortedSet('redisQ:allQueues');
     $objectQueues = new RedisTtlSortedSet('objectQueues');
     $queues = $allQueues->getMembers();
     $multi = $redis->multi();
     // Store an instance of the object
     $objectID = 'redisQ:objectID:' . uniqID() . md5($wrapped);
     $objectQueues->add(time(), $objectID);
     $multi->setex($objectID, 9600, $wrapped);
     // Add objectID to all queues
     foreach ($queues as $queueID) {
         $multi->lPush($queueID, $objectID);
         $multi->expire($queueID, 9600);
     }
     $multi->exec();
 }