Move cache garbage collection from Bash to PHP