Class FakeTicker

  • All Implemented Interfaces:

    public class FakeTicker
    extends Object
    implements com.github.benmanes.caffeine.cache.Ticker
    Fake ticker implementation that allows testing ticker sensitive cache. Includes a current time in nanoseconds and allows advancing it by a given amount of time.
    • Constructor Detail

      • FakeTicker

        public FakeTicker()
    • Method Detail

      • read

        public long read()
        Specified by:
        read in interface com.github.benmanes.caffeine.cache.Ticker
      • advance

        public void advance​(Duration duration)
        Advances the fake timer by a given duration. The duration is transformed into nanoseconds
        duration - - Duration to advance the fake timer