I know how to do this manually: Settings > Site administration > Themes > Theme selector. Click the “Clear theme caches” button.
But I don't know how to do it programatically or even make it directly manipulate the database.
Please kindly read the forum rules as any answer may depend on the version of Moodle you are using.
Why do you want to do this? When do you want to do this? Do you want to do this from a theme or something else? If in a theme, do you want this to happen when a setting changes or something else?
Thank you for your notice. I want to clean the theme cache in a cron task. My Moodle version is 3.4.
Silly question, why?