Implement mem_queue