Document and data size in ios

We want to give the user the ability to clear "document and data". We first try to calculate the size by summing the size of all the files in that directory FileManager.default.urls(for: .cachesDirectory, in: .userDomainMask).first. But after calculating the size, we see that the size of the "document and data" that the user sees in the storage is larger than the size of our cache in ios 17. But in earlier versions 16, 15, etc. this directory is not taken into account when calculating the size . Which directories are counted in ios 17? And what directories are taken into account in an earlier version of iOS?

Document and data size in ios
 
 
Q