Handler invocation cache

this needs a code review. any takers?

issue #1017
note there is a TODO to remove the old version after you validate the performance tests