@@ -143,6 +143,19 @@ public static function dequeue($queue, $items = Array())
143143 }
144144 }
145145
146+ /**
147+ * Remove specified queue
148+ *
149+ * @param string $queue The name of the queue to remove.
150+ * @return integer number of deleted items
151+ */
152+ public static function removeQueue ($ queue )
153+ {
154+ $ num = self ::removeList ($ queue );
155+ self ::redis ()->srem ('queues ' , $ queue );
156+ return $ num ;
157+ }
158+
146159 /**
147160 * Pop an item off the end of the specified queues, using blocking list pop,
148161 * decode it and return it.
@@ -264,12 +277,12 @@ private static function removeItems($queue, $items = Array())
264277 $ originalQueue = 'queue: ' . $ queue ;
265278 $ tempQueue = $ originalQueue . ':temp: ' . time ();
266279 $ requeueQueue = $ tempQueue . ':requeue ' ;
267-
280+
268281 // move each item from original queue to temp queue and process it
269282 $ finished = false ;
270283 while (!$ finished ) {
271284 $ string = self ::redis ()->rpoplpush ($ originalQueue , self ::redis ()->getPrefix () . $ tempQueue );
272-
285+
273286 if (!empty ($ string )) {
274287 if (self ::matchItem ($ string , $ items )) {
275288 self ::redis ()->rpop ($ tempQueue );
@@ -294,7 +307,7 @@ private static function removeItems($queue, $items = Array())
294307 // remove temp queue and requeue queue
295308 self ::redis ()->del ($ requeueQueue );
296309 self ::redis ()->del ($ tempQueue );
297-
310+
298311 return $ counter ;
299312 }
300313
0 commit comments