Search code examples
javaguava

Is getIfPresent considered as a get operation for expireAfterAccess?


Does the getIfPresent function reset the time for expireAfterAccess?


Solution

  • The CacheBuilder.expireAfterAccess() docs say:

    Access time is reset by all cache read and write operations

    Since Cache.getIfPresent() is a cache read, it resets the access time.