Add an optional cache for functional parameters, which can greatly speed up parameter retrieval when the underlying function is slow.
Reset the cache in cache_funcs when setting its value anew.