   Simple implementation. Very simple API. Reliable. Fast.
 
   Redis keys:
-    * carmine:mq:<qname>:messages      -> hash, {mid mcontent}.
-    * carmine:mq:<qname>:locks         -> hash, {mid lock-expiry-time}.
-    * carmine:mq:<qname>:backoffs      -> hash, {mid backoff-expiry-time}.
-    * carmine:mq:<qname>:nretries      -> hash, {mid retry-count}.
-    * carmine:mq:<qname>:mid-circle    -> list, rotating list of mids.
-    * carmine:mq:<qname>:recently-done -> set, for efficient mid removal from circle.
-    * carmine:mq:<qname>:eoq-backoff?  -> ttl flag, used for queue-wide (every-worker)
-                                          polling backoff.
-    * carmine:mq:<qname>:ndry-runs     -> int, number of times worker(s) have burnt
-                                          through queue w/o work to do.
+    * carmine:mq:<qname>:msgs         -> hash, {mid mcontent}.
+    * carmine:mq:<qname>:locks        -> hash, {mid lock-expiry-time}.
+    * carmine:mq:<qname>:backoffs     -> hash, {mid backoff-expiry-time}.
+    * carmine:mq:<qname>:nretries     -> hash, {mid retry-count}.
+    * carmine:mq:<qname>:mid-circle   -> list, rotating list of mids.
+    * carmine:mq:<qname>:gc           -> set, for efficient mid removal from circle.
+    * carmine:mq:<qname>:eoq-backoff? -> ttl flag, used for queue-wide (every-worker)
+                                         polling backoff.
+    * carmine:mq:<qname>:ndry-runs    -> int, number of times worker(s) have burnt
+                                         through queue w/o work to do.
 
   Ref. http://antirez.com/post/250 for basic implementation details."
   {:author "Peter Taoussanis"}

    local lock_exp    = tonumber(redis.call('hget', _:qk-locks,    _:mid) or 0)
    local backoff_exp = tonumber(redis.call('hget', _:qk-backoffs, _:mid) or 0)

    if redis.call('hexists', _:qk-messages, _:mid) ~= 1 then
      if (now < backoff_exp) then return 'done-with-backoff' end
      return nil
    else
      if redis.call('sismember', _:qk-recently-done, _:mid) == 1 then
        if (now < backoff_exp) then return 'done-with-backoff' end
        return 'recently-done'
      else
        if     (now < lock_exp)    then return 'locked'
        elseif (now < backoff_exp) then return 'retry-backoff' end
        return 'queued'
      end
    end"
    {:qk-messages      (qkey qname :messages)
     :qk-locks         (qkey qname :locks)
     :qk-backoffs      (qkey qname :backoffs)
     :qk-recently-done (qkey qname :recently-done)}
    {:now (System/currentTimeMillis)
     :mid mid})))


(defn dequeue
  "IMPLEMENTATION DETAIL: Use `worker` instead.
  Rotates queue's mid-circle and processes next mid. Returns:
    nil             - If msg already GC'd, locked, or set to backoff.
    \"eoq-backoff\" - If circle uninitialized or end-of-circle marker reached.
    [<mid> <mcontent> <attempt-count>] - If message should be (re)handled now."
  [qname & [{:keys [lock-ms eoq-backoff-ms]
