Use Queue in memory backend

Not sure if this is an improvement or not, but it was easy to try. Popping an empty queue now requires exception handling, so there might be a performance degradation. If so it's probably not worth the change.