Hi ,

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
>
> ------------------ 原始邮件 ------------------发件人:
>
>                 "dev"
>                               <[email protected]>;发送时间:
> 2021年5月17日(星期一) 下午3:43收件人: "dev"<[email protected]>;主题: Re: There may
> be a wrong way to use guava cacheHi Zhen,Please send the raw text to this
> mail list.--Zhang YonglunApache ShenYu (Incubating)Apache
> ShardingSpherettttangzhen <[email protected]> 于2021年5月17日周一 下午3:37写道:> in
> org.apache.shenyu.plugin.apache.dubbo.cache.ApplicationConfigCache and>
> ApplicationConfigCache in other RPC plugin>>>
> ------------------------------------------------------------------------------------------------>
> private final LoadingCache<&gt; cache =>
> CacheBuilder.newBuilder()&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;>>
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp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sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;>
> .build();> private int getSize() {&nbsp;&nbsp;&nbsp;> &nbsp;&nbsp;&nbsp;
> 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