Making the retrieval of the cache store class a method

The retrieval of the cache store class inside of ``lookup_store`` is complicated and should probably be encapsulated into its own method. Refactoring this logic into a class removes the need to use local variables and makes the code a little cleaner to read.

I've also added some comments that help explain what ``expand_cache_key`` is doing.