refactor logToCache