cache system refactored