Add caching to ParamOpt.