Files
2026-11-21 17:07:18 -05:00

134 lines
3.0 KiB
Java

/* */ package kong.unirest.cosmetics;
/* */
/* */ import java.time.Instant;
/* */ import java.util.concurrent.CompletableFuture;
/* */ import java.util.concurrent.TimeUnit;
/* */ import java.util.function.Supplier;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public interface Cache
/* */ {
/* */ <T> HttpResponse get(Key paramKey, Supplier<HttpResponse<T>> paramSupplier);
/* */
/* */ <T> CompletableFuture getAsync(Key paramKey, Supplier<CompletableFuture<HttpResponse<T>>> paramSupplier);
/* */
/* */ public static interface Key
/* */ {
/* */ boolean equals(Object param1Object);
/* */
/* */ int hashCode();
/* */
/* */ Instant getTime();
/* */ }
/* */
/* */ @FunctionalInterface
/* */ public static interface KeyGenerator
/* */ {
/* */ Cache.Key apply(HttpRequest param1HttpRequest, Boolean param1Boolean, Class<?> param1Class);
/* */ }
/* */
/* */ static Builder builder() {
/* 63 */ return new Builder();
/* */ }
/* */
/* */ public static class Builder {
/* 67 */ private int depth = 100;
/* 68 */ private long ttl = 0L;
/* */ private Cache backing;
/* */ private Cache.KeyGenerator keyGen;
/* */
/* */ CacheManager build() {
/* 73 */ if (this.backing != null) {
/* 74 */ return new CacheManager(this.backing, this.keyGen);
/* */ }
/* 76 */ return new CacheManager(this.depth, this.ttl, this.keyGen);
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public Builder depth(int value) {
/* 88 */ this.depth = value;
/* 89 */ return this;
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public Builder maxAge(long number, TimeUnit units) {
/* 102 */ this.ttl = units.toMillis(number);
/* 103 */ return this;
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public Builder backingCache(Cache cache) {
/* 113 */ this.backing = cache;
/* 114 */ return this;
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public Builder withKeyGen(Cache.KeyGenerator keyGenerator) {
/* 124 */ this.keyGen = keyGenerator;
/* 125 */ return this;
/* */ }
/* */ }
/* */ }
/* Location: C:\Users\Xiao\Downloads\MinehutCosmetics.jar!\kon\\unirest\cosmetics\Cache.class
* Java compiler version: 11 (55.0)
* JD-Core Version: 1.1.3
*/