Hi @akaRahim, hope you are doing well.
The reason to use different buffers is due to the nature of the operation. Enqueue means that you are adding things to the queue and want to process it (dump to disc latter) and DeQueue means you are remove items from the Queue (and you don’t want to wait a long time to retrieve the element from the Queue). Hence, two buffers are needed since they will be storing different things with different contexts.
A buffer can be implemented just like a cache is, with same features of a cache. So, we could implement this in a Key-Value database (i.e. Redis) or something like memcached. For Enqueue we can set a default value that when reached, all items are added to the queue, respecting the order they were added. For Dequeueing, we can keep last tree items in this buffer, when we consume the buffer the item is removed and a new item is dequeue from the Queue and added to buffer.
Hope this helps!
-Artur Baruchi