net.moznion.auto_refresh_cache.CacheWithScheduledFuture Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of auto-refresh-cache Show documentation
Show all versions of auto-refresh-cache Show documentation
Cached object that can be refreshed automatically when cache is expired
The newest version!
package net.moznion.auto_refresh_cache;
import java.util.Optional;
import java.util.concurrent.Future;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Data;
/**
* Cached value with {@link Future} which is scheduled task as async.
*
* @param Type of cache value.
*/
@Data
@AllArgsConstructor(access = AccessLevel.PACKAGE)
public class CacheWithScheduledFuture {
/**
* Cached value.
*/
T cached;
/**
* Future of scheduled task as async. The Future's get method will return the given result upon successful completion.
*/
Optional> future;
}