Only use cache if configuration option is true.