Skip to content

Expiry javadoc is a bit misleading #217

@facboy

Description

@facboy

The javadoc for com.github.benmanes.caffeine.cache.Expiry states:

To indicate no expiration an entry may be given an excessively long period, such as Long#MAX_VALUE.

This isn't strictly accurate as if you use Long.MAX_VALUE the expiry (now + duration) overflows and you end up with a negative eviction time, ie the entry gets evicted almost immediately.

It looks like this scenario is guarded against in the Async code by restricting the effective duration to (Long.MAX_VALUE >> 1) but this isn't done in com.github.benmanes.caffeine.cache.BoundedLocalCache.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions