Moved common caching code into new CachedDistribution class