MDL-37683 cache: improved indentifier collection and storage