How to delete cache/storage if app has been updated/reinstalled?

How can I check if the app has been updated and delete the cache and storage on the phone for ios and android?

Thanks

My first thought is to store the app version (probably using the Cordova App Version plugin), then check the current version against the stored version.