refactor cache to cache class
use wait to instead of sleep, exit faster now