load CHI on-demand

Instead of always loading CHI, now it will only load when a cache will
actually be used.  This is to save compile time when the nocache option
is specified.