Added identifier cache.

Identifiers are now cached for faster comparison. Note that the equal's
method of case classes will first check for reference equality, so
Identifier.equals doesn't have to be overwritten.