set up the cache by checking expiration and current time
 fix minor bugs