In my web application, I process the pages using a PHP script and then generate static HTML files from them. Static HTML is provided to users for better performance. HTML files eventually become obsolete and need to be deleted.
I discuss two ways to write an eviction script.
First, one find command is used, for example
find /var/www/cache -type f -mmin +10 -exec rm \{} \;
The second form is laying through xargs, something like
find /var/www/cache -type f -mmin +10 -print0 | xargs -0 rm
The first form calls rm for each file found, and the second form simply sends all the file names to one rm (but the list of files can be very long).
Which shape will be faster?
In my case, the cache directory is shared between several web servers, so all this is done via NFS, if that matters for this problem.
unix shell find xargs
yhager
source share