Added helper function mkcachedir.