Added caching of type to codec. This allows efficient retrieval of codec for a type at the cost of slightly more memory consumption