some work on the cache system
Implements the cache system