Caching may save performance of your system. For example, Caffeine Cache is one of powerful cache libraries that offer various configuration options. Speaking of options... do you know how to configure Caffeine Cache? Check sixty second question of full-stack dev quiz to check it.
Caffeine Cache is a library, that you can just use it instead of creating your own cache implementation. If you are already familiar with it, do you know which CaffeineCacheManager option to use, to meet the following requirements?
- If requested for the first time, don't use cache, get it in the regular way (from a database or calculate it).
- If it was added to the cache no longer than 1 minute ago, get it from the cache.
- If it was added to the cache longer than 1 minute ago, get it in the regular way (from a database or calculate it) and replace it in the cache.
Choose one valid answer.
- maximumSize(100)
- maximumWeight(1)
- initialCapacity(1)
- expireAfterAccess(1, TimeUnit.MINUTES)
- expireAfterWrite(1, TimeUnit.MINUTES
For the correct answer scroll down
.
.
.
.
.
.
The correct answer is: e. If you would like to read more, check Cache in Spring Boot 3 application article.