Rest API Head Tags WP plugin - Clear cache periodically

Description

I would like it, if there would be a scheduled clean-up setting, to purge the Head Tags cache (e.g. weekly) automatically.

Examples

Our site is a news site, with 2000 news at the moment. I’m really happy, that the Head Tags are cached, but I don’t want old news to be still cached, as my DB will grow too large.

Possible solution

Thanks for suggesting this @koli14 :slightly_smiling_face: I think it may make a lot of sense. @David As you were the one more involved with this plugin, do you have any feedback here?

Yup, let me give some feedback.

We are using WordPress transients to store the cached head tags. They are configured to last up to 30 days, but transients are only removed from the DB when they are requested again after expired so I completely understand your problem, @koli14. :sweat_smile:

A possible solution would be to implement our own system to remove automatically all expired transients created by the Head Tags plugin. Also, we could add an option in the admin panel to change the default expiration time (currently is 30 days).

@koli14, in the meantime, there are some plugins that remove expired transients automatically (like Delete Expired Transients) but, yeah, it totally makes sense to add an auto-clean cache feature for the REST API - Head Tags plugin so it doesn’t depend on third-party plugins.

1 Like