Move import to top of file.
Only load the object cache when requested.

Instead of loading a cache key that may not exist on every request, it
should only be loaded when required.

Fixes #3717