Make class content cache's validation check more robust

For cached responses that contain data from multiple files, the code could
return outdated results if some of the base class's file have been modified
since.
Also implemented the sweeping of the cache store when cache miss occurs.