Support templates

includes previous PR's (cache and statsd objects), but this is cherrypickable.