How do we create a cache key that refreshes every month?

I refer to the documentation about Using keys and templates in topic about Caching.

It helpfully lists down some popular caching strategies, however, it doesn’t specify how might we further enhance/manipulate the provided templates to better serve our use case.

Specifically, we’re trying to implement a cache key that always updates on the calendar month (every 30 days is fine too). It’s a crude way for us to clear and re-initialise our cache preventing it from better too large.

Is there a good way for us to do so?

Thanks!