Package org.cache2k.operation
Interface Weigher<K,V>
- 
- All Superinterfaces:
 Customization,DataAware<K,V>,DataAwareCustomization<K,V>
public interface Weigher<K,V> extends DataAwareCustomization<K,V>
Allows giving cached values a weight and limit the cache capacity by total weight.- Author:
 - Jens Wilke
 
 
- 
- 
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description intweigh(K key, V value)Returns a weight for the given cached value. 
 - 
 
- 
- 
Method Detail
- 
weigh
int weigh(K key, V value)
Returns a weight for the given cached value. This will be called after a value is inserted or updated.The cache implementations may derive an approximate value which has less precision. The total weight in the statistics represents an approximation as well.
- Returns:
 - a positive value representing the relative weight in comparison to the other entries in the cache.
 
 
 - 
 
 -