Does du or df perform caching?
There is no need for caching in df
as df
does a single statfs()
call (per filesystem). And obviously this call does read files on disk and sum up their sizes... The filesystems (e.g. the kernel) keep track of the free space.
du
uses (without being aware of that) the page cache all applications use. In order to cache explicitly between runs there would have to be a "du daemon" anyway.