Restructure the code and (temporarily) remove the caching functionality.

This revision splits the code into more manageable units by separating
the main program, the proxy functionality, and the cache.  Caching is
temporarily disabled, but a new interface for pluggable caches is
added which hopefully will make it easy to re-add caching in later
commits.