maximumWeight(maxCount)  mean max total weight, 
but the method getSize return weight may cause that when the number of caches 
increases to 316, adding a new cache will delete many caches
I think maximumSize should be used here instead of maximumWeight.

if you think so, I will fix it


------------------ ???????? ------------------??????:                           
                                                                                
             "dev"                                                              
                      <[email protected]>;????????: 2021??5??17??(??????) 
????3:52??????: "dev"<[email protected]>;????: Re: There may be a wrong way 
to use guava cacheHi ??maxCount is capacity of guava cache??others 
thinks??ttttangzhen <[email protected]> ??2021??5??17?????? 
????3:48??????> in 
org.apache.shenyu.plugin.apache.dubbo.cache.ApplicationConfigCache and> 
ApplicationConfigCache in other RPC plugin>> 
------------------------------------------------------------------------------------------------>
 private final LoadingCache<> cache = CacheBuilder.newBuilder()>> 
.maximumWeight(maxCount)>> .weigher( (string, referenceConfig) -> getSize())>> 
.build();>> private int getSize() {> return (int) cache.size();> }>> 
------------------------------------------------------------------------------------------------>>
 Here, weight is used to control the total capacity of guava cache, but the> 
weight of each cache use getSize,it represents the total number of items> 
cached when a piece of data is cached.> I think there may be wrong usage here, 
If we use weights, the weights> should represent the size of each piece of 
data, so here should be replaced> by the number of bars to control the total 
capacity

Reply via email to