Cache result of some functions.

This adds the boolean constraint 'cache_system_functions' to
common control, defaulting to true. Functions classified as such
will be memoized for the duration of an agent run.