move caching mechanism from resolve to __call__
replace if-else with try-except around cache

This improves performance in the caching case at the cost of the non-cached
case.