Class EvictionFactory


  • public class EvictionFactory
    extends Object
    Author:
    Jens Wilke
    • Constructor Detail

      • EvictionFactory

        public EvictionFactory()
    • Method Detail

      • constructEviction

        public Eviction constructEviction​(InternalCacheBuildContext customizationContext,
                                          HeapCacheForEviction hc,
                                          InternalEvictionListener l,
                                          org.cache2k.config.Cache2kConfig config,
                                          int availableProcessors)
        Construct segmented or queued eviction. For the moment hard coded. If capacity is at least 1000 we use 2 segments if 2 or more CPUs are available. Segmenting the eviction only improves for lots of concurrent inserts or evictions, there is no effect on read performance.
      • determineMaxSize

        public static long determineMaxSize​(long entryCapacity,
                                            int segmentCount)
      • determineMaxWeight

        public static long determineMaxWeight​(long maximumWeight,
                                              int segmentCount)
      • determineSegmentCount

        public static int determineSegmentCount​(boolean strictEviction,
                                                int availableProcessors,
                                                boolean boostConcurrency,
                                                long entryCapacity,
                                                long maxWeight,
                                                int segmentCountOverride)
        Determine number of segments based on the the available processors. For small cache sizes, no segmentation happens at all.