client-java icon indicating copy to clipboard operation
client-java copied to clipboard

Consider to rewrite regioncache to reduce the cache number.

Open shiyuhang0 opened this issue 3 years ago • 0 comments

Feature Request

Is your feature request related to a problem? Please describe:

Describe the feature you'd like:

Now, RegionCache needs three Maps to store the cache. it is easily cause error because of the inconsistency of the cache.

public class RegionCache {
  private final Map<Long, TiRegion> regionCache;
  private final Map<Long, TiStore> storeCache;
  private final RangeMap<Key, Long> keyToRegionIdCache;
}

I suggest using two caches.

public class RegionCache {
    private final Map<Long, TiStore> storeCache;
    private final RangeMap<Key, TiRegion> regionCache;
}

Describe alternatives you've considered:

Teachability, Documentation, Adoption, Migration Strategy:

shiyuhang0 avatar Dec 26 '22 09:12 shiyuhang0