how to delete kodi cache automatically ?

why would you want that?
if your referring to the epg data just goto System,TV and under the guide tab enable "Don't cache in local database",you need the setting level set to Advanced or Expert to see it.
when I want to update my guide all I do is restart kodi,I don't clear anything.
 
Thats how i have it set, i ask mainly because i read that in order to eliminate most buffering and sluggishness its best to start kodi with an empty cache.. Thats why i asked if there was a way, a lazy way of have it automatically set.