@Test public void testHashQuality100_10() { assertEquals(95, CacheBaseInfo.hashQuality(100, 10)); }
static int hashQuality(int noCollisionPercent, int longestSlot) { if (longestSlot == 0) { return 100; } int correctionForOversizeSlot = (int) ((1 - Math.exp(EXPONENT_CONSTANT * Math.max(0, longestSlot - SLOT_SIZE_MINIMUM))) * 100); int quality = noCollisionPercent - correctionForOversizeSlot; return Math.max(0, Math.min(100, quality)); }
CacheBaseInfo implements InternalCacheInfo { static int hashQuality(int noCollisionPercent, int longestSlot) { if (longestSlot == 0) { return 100; } int correctionForOversizeSlot = (int) ((1 - Math.exp(EXPONENT_CONSTANT * Math.max(0, longestSlot - SLOT_SIZE_MINIMUM))) * 100); int quality = noCollisionPercent - correctionForOversizeSlot; return Math.max(0, Math.min(100, quality)); } }
CacheBaseInfo implements InternalCacheInfo { static int hashQuality(int noCollisionPercent, int longestSlot) { if (longestSlot == 0) { return 100; } int correctionForOversizeSlot = (int) ((1 - Math.exp(EXPONENT_CONSTANT * Math.max(0, longestSlot - SLOT_SIZE_MINIMUM))) * 100); int quality = noCollisionPercent - correctionForOversizeSlot; return Math.max(0, Math.min(100, quality)); } CacheBaseInfo(HeapCache heapCache, InternalCache userCache, long now); }
CacheBaseInfo implements InternalCacheInfo { static int hashQuality(int noCollisionPercent, int longestSlot) { if (longestSlot == 0) { return 100; } int correctionForOversizeSlot = (int) ((1 - Math.exp(EXPONENT_CONSTANT * Math.max(0, longestSlot - SLOT_SIZE_MINIMUM))) * 100); int quality = noCollisionPercent - correctionForOversizeSlot; return Math.max(0, Math.min(100, quality)); } CacheBaseInfo(HeapCache heapCache, InternalCache userCache, long now); void setInfoCreationDeltaMs(int millis); @Override String getName(); @Override String getImplementation(); @Override long getExplicitLoadCount(); @Override long getSize(); @Override long getHeapCapacity(); @Override long getMaximumWeight(); @Override long getTotalWeight(); @Override long getEvictedWeight(); @Override long getGetCount(); @Override long getMissCount(); @Override long getNewEntryCount(); @Override long getHeapHitCount(); @Override long getLoadCount(); @Override long getRefreshCount(); @Override long getInternalExceptionCount(); @Override long getRefreshRejectedCount(); @Override long getSuppressedExceptionCount(); @Override long getLoadExceptionCount(); @Override long getRefreshedHitCount(); @Override long getExpiredCount(); @Override long getEvictedCount(); @Override int getEvictionRunningCount(); @Override long getRemoveCount(); @Override long getPutCount(); @Override long getGoneSpinCount(); @Override long getKeyMutationCount(); @Override long getTimerEventCount(); @Override double getHitRate(); @Override String getHitRateString(); @Override double getMillisPerLoad(); @Override long getLoadMillis(); @Override String getIntegrityDescriptor(); @Override long getStartedTime(); @Override long getClearedTime(); @Override long getInfoCreatedTime(); @Override int getInfoCreationDeltaMs(); @Override Collection<HealthInfoElement> getHealth(); @Override long getAsyncLoadsStarted(); @Override long getAsyncLoadsInFlight(); @Override int getLoaderThreadsLimit(); @Override int getLoaderThreadsMaxActive(); @Override String getExtraStatistics(); @Override long getClearCount(); long getClearedEntriesCount(); String toString(); }
CacheBaseInfo implements InternalCacheInfo { static int hashQuality(int noCollisionPercent, int longestSlot) { if (longestSlot == 0) { return 100; } int correctionForOversizeSlot = (int) ((1 - Math.exp(EXPONENT_CONSTANT * Math.max(0, longestSlot - SLOT_SIZE_MINIMUM))) * 100); int quality = noCollisionPercent - correctionForOversizeSlot; return Math.max(0, Math.min(100, quality)); } CacheBaseInfo(HeapCache heapCache, InternalCache userCache, long now); void setInfoCreationDeltaMs(int millis); @Override String getName(); @Override String getImplementation(); @Override long getExplicitLoadCount(); @Override long getSize(); @Override long getHeapCapacity(); @Override long getMaximumWeight(); @Override long getTotalWeight(); @Override long getEvictedWeight(); @Override long getGetCount(); @Override long getMissCount(); @Override long getNewEntryCount(); @Override long getHeapHitCount(); @Override long getLoadCount(); @Override long getRefreshCount(); @Override long getInternalExceptionCount(); @Override long getRefreshRejectedCount(); @Override long getSuppressedExceptionCount(); @Override long getLoadExceptionCount(); @Override long getRefreshedHitCount(); @Override long getExpiredCount(); @Override long getEvictedCount(); @Override int getEvictionRunningCount(); @Override long getRemoveCount(); @Override long getPutCount(); @Override long getGoneSpinCount(); @Override long getKeyMutationCount(); @Override long getTimerEventCount(); @Override double getHitRate(); @Override String getHitRateString(); @Override double getMillisPerLoad(); @Override long getLoadMillis(); @Override String getIntegrityDescriptor(); @Override long getStartedTime(); @Override long getClearedTime(); @Override long getInfoCreatedTime(); @Override int getInfoCreationDeltaMs(); @Override Collection<HealthInfoElement> getHealth(); @Override long getAsyncLoadsStarted(); @Override long getAsyncLoadsInFlight(); @Override int getLoaderThreadsLimit(); @Override int getLoaderThreadsMaxActive(); @Override String getExtraStatistics(); @Override long getClearCount(); long getClearedEntriesCount(); String toString();  }