Skip to content

The stats ticker does not use the builder's ticker. #240

@jwiklund

Description

@jwiklund

Building a cache loader that uses both stats and expiration (eg recordStats and expireAfterWrite) and providing a ticker for testing builds a cache that uses system time for stats and the provided ticker for expiration.

This can become a problem because the CacheStats constructor validates that variables are not negative, which they can become if the stubbed ticker's time is in the future (or more than System.nanoTime), in general it's possible to test refresh by ensuring that start time + refresh time is never more than System.nanoTime, but when the computer is restarted (On my linux desktop the jvm seems to use time since startup) tests can not be made to pass until the uptime is more than the refresh time.

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