设置一个固定尺寸的 queue,如果有新的值压入则自动弹出尾值
enqueue(Value, Queue) ->
Pushed = queue:in(Value, Queue),
case queue:len(Pushed) of
Len when Len > 10 ->
Popped = queue:drop(Pushed),
{Popped, queue:len(Pushed)};
_ ->
{Pushed, queue:len(Pushed)}
end.