Closed chesio closed 5 years ago
I think matching what du -sb
reports is the way to go.
It's actually a little bit more complicated: Core::getCacheSizes()
only reports file sizes of files that are expected to be there and depends on bc-cache/filter:request-variants
filter to correctly return all variants, while Core::getDirectorySize()
does not care and counts all files that are present in root cache directory and its subdirectories.
So both methods can/should report different overall cache sizes if:
bc-cache/filter:request-variants
filter.bc-cache/filter:request-variants
filter has been adjusted, but cache have not been flushed yet - in such case there might be stray files ignored by Core::getCacheSizes()
.
Right now there are two methods that calculate cache size:
Core::getDirectorySize()
calculates the size including directories whileCore::getCacheSizes()
only reports file sizes.The difference can be seen when running
bc-cache size
command in WP-CLI (it uses the first method) and comparing the output to what Cache Viewer reports (it uses the second method).I'm not sure in the moment what the better approach is.