Optimize predictBeanType implementation

Fix triple lookup in the cache