Checkin of several cache related bug fixes -- metadata cache still
doesn't pass regression tests.