Make GetClassContents() implementation use GetCachedClassContents()

This removes duplicated class content fetching code and makes these lookups
cached.
Tests updated to new parameters.
Remove unused imports argument from getclasscontent functions