Fix the logic to check if /cache exists

Change-Id: Ic15f36bf57dc1b19a08c41da76c7ee2ca19f4e0d