I want to use cat filepath > /dev/null
as a cheap memory caching mechanism.
What I am wondering about is: if I call it a second time, and the file
is already in the disk cache, is the OS smart enough to do nothing?
Update: I've tested this on a CIFS volume, using fadvise POSIX_FADV_WILLNEED to cache the file locally (using linux-ftools on command line). Turns out that the volume needs to be mounted in read-write mode for this to work. In read only mode, the fadvise seems to be ignored. This must have something to do with the samba oplock mechanism.