Class AbstractClimber

    • Field Detail

      • sampleSize

        protected int sampleSize
      • hitsInMain

        protected int hitsInMain
      • hitsInWindow

        protected int hitsInWindow
      • hitsInSample

        protected int hitsInSample
      • missesInSample

        protected int missesInSample
      • previousHitRate

        protected double previousHitRate
    • Constructor Detail

      • AbstractClimber

        public AbstractClimber()
    • Method Detail

      • onMiss

        public void onMiss​(long key,
                           boolean isFull)
        Description copied from interface: HillClimber
        Records that a miss occurred with a full cache.
        Specified by:
        onMiss in interface HillClimber
        Parameters:
        key - the key accessed
        isFull - if the cache is fully populated and had to evict
      • onHit

        public void onHit​(long key,
                          HillClimber.QueueType queueType,
                          boolean isFull)
        Description copied from interface: HillClimber
        Records that a hit occurred with a full cache.
        Specified by:
        onHit in interface HillClimber
        Parameters:
        key - the key accessed
        queueType - the queue the entry was found in
        isFull - if the cache is fully populated
      • adapt

        public HillClimber.Adaptation adapt​(double windowSize,
                                            double probationSize,
                                            double protectedSize,
                                            boolean isFull)
        Description copied from interface: HillClimber
        Determines how to adapt the segment sizes.
        Specified by:
        adapt in interface HillClimber
        Parameters:
        windowSize - the current window size
        probationSize - the current probation size
        protectedSize - the current protected size
        isFull - if the cache is fully populated
        Returns:
        the adjustment to the segments
      • adjust

        protected abstract double adjust​(double hitRate)
        Returns the amount to adapt by.
      • resetSample

        protected void resetSample​(double hitRate)
        Starts the next sample period.