[core] Proper drop cache.
[core] Add a test for caching.