[
https://issues.apache.org/jira/browse/OAK-4578?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15385770#comment-15385770
]
Thomas Mueller commented on OAK-4578:
-------------------------------------
It would be better to get rid of the "average" and instead resize the internal
array when needed. If the weight of entries varies a lot, using the average is
problematic, for example if there are many (let's say 1 million) entries of
weight 1, and one entry of weight one million. In that case, the average
weight, in order to get a good internal array size, should be 1. This is an
extreme case (for illustration only) and I guess it's not that bad in practise.
The "put with memory" method should be removed because it is not needed.
The CacheStats should be able to get the weigher and max weigh from the cache.
Using the terms "memory", "weight", and "size" is a bit confusing, it would be
better to just one one of those.
> Clarify weight related methods/parameters/arguments of the LIRS cache
> ---------------------------------------------------------------------
>
> Key: OAK-4578
> URL: https://issues.apache.org/jira/browse/OAK-4578
> Project: Jackrabbit Oak
> Issue Type: Improvement
> Components: core
> Reporter: Michael Dürig
> Assignee: Thomas Mueller
> Labels: documentation
> Fix For: 1.5.6
>
>
> {{CacheLIRS}} has various means for specifying the weight of an element:
> * via {{setAverageMemory()}}
> * via {{CacheLIRS.Builder.averageWeight()}}
> * via {{CacheLIRS.Builder.weigher()}}
> * via the {{memory}} argument of {{put()}}
> It is not clear how this various ways interact which each other when
> specifying one but not the other and which would take precedence if multiple
> are specified.
> Moreover there is the related {{CacheStats}} class, which also require a
> {{Weigher}}. How does that one related to the arguments of the respective
> cache instance?
> [~tmueller], could you please help clarifying these points? E.g. by expanding
> on the Javadoc.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)