[NUCCORE-1214] Adapted patch for metadata caching to reduce scope of
synchronized code