How can I record audio streams like a "first in, first out"?

How can I record audio streams in a “first in, first out” manner?

I’m trying to keep snippets of interesting radio streams. There’s no way to know when the “interesting parts” will come up, so I’ll have to be recording all the time to be sure nothing is missed.

But it doesn’t make sense to keep terabytes of radio data on the harddisk. How can I keep only the latest 30min of recording cache ? Since I’ll be listening live anyway, I can go back to extract the targeted 5-10 from the cache as and when needed.

Audacity does not do that, but there is a suggestion from another user here: