Refactored cache system

All the cache related code is now in its own file.
Also, the heavy pages are cached on startup.