Ensure cache directories exist.