CacheHandler: fix cache rebuilding issue