#33 Modified and unit tested cache building

Cache building is now half done outside of the packages controller
#33 modified and unit tested repository caching