Skip to content

How to use 'Fake Ticker' with Caffeine? #810

Answered by ben-manes
brent-holland asked this question in Q&A
Discussion options

You must be logged in to vote

You missed the method reference to adapt. =)

FakeTicker ticker = new FakeTicker(); // Guava's testlib
Cache<Key, Graph> cache = Caffeine.newBuilder()
    .expireAfterWrite(10, TimeUnit.MINUTES)
    .executor(Runnable::run)
    .ticker(ticker::read)
    .maximumSize(10)
    .build();

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@brent-holland
Comment options

Answer selected by ben-manes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants