add scan cache data structure
kill the bug of quadratic memory usage.
Change filedb to be dict of dict.