-
public interface Cache
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceCache.CacheBuilderstatic interfaceCache.CacheEntrystatic classCache.InMemoryCacheBuilderstatic interfaceCache.Writer<T>
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description voidevict(java.net.http.HttpRequest request)Evicts cache entry (if any) associated withrequest.voidevictAll()Removes all cache entries.voidevictAll(java.net.http.HttpRequest request)Evicts all cache entries associated withrequest.Cache.CacheEntryget(java.net.http.HttpRequest request)Gets the cache entry associated withrequest.static Cache.InMemoryCacheBuildernewInMemoryCacheBuilder()Creates a newInMemoryCacheBuilderinstance.static Cachenoop()Gets theCacheeffectively does not do anything.voidput(java.net.http.HttpRequest request, Cache.CacheEntry entry)Associatesrequestwithentryand stores it in this cache.<T> Cache.Writer<T>writer(CacheEntryMetadata metadata)Creates aWriter.
-
-
-
Method Detail
-
newInMemoryCacheBuilder
static Cache.InMemoryCacheBuilder newInMemoryCacheBuilder()
Creates a newInMemoryCacheBuilderinstance.- Returns:
- the new
InMemoryCacheBuilder.
-
noop
static Cache noop()
Gets theCacheeffectively does not do anything.- Returns:
- a stub cache.
-
get
Cache.CacheEntry get(java.net.http.HttpRequest request)
Gets the cache entry associated withrequest.- Parameters:
request- The request.- Returns:
- the cache entry associated with
requestornull.
-
put
void put(java.net.http.HttpRequest request, Cache.CacheEntry entry)Associatesrequestwithentryand stores it in this cache. The previously (if any) associated entry will be evicted.- Parameters:
request- The request.entry- The entry.
-
evict
void evict(java.net.http.HttpRequest request)
Evicts cache entry (if any) associated withrequest.- Parameters:
request- The request.
-
evictAll
void evictAll(java.net.http.HttpRequest request)
Evicts all cache entries associated withrequest.- Parameters:
request- The request.
-
evictAll
void evictAll()
Removes all cache entries. This cache will be empty after method invocation.
-
writer
<T> Cache.Writer<T> writer(CacheEntryMetadata metadata)
Creates aWriter.- Type Parameters:
T- The response body type.- Parameters:
metadata- The metadata.- Returns:
- a
Writer.
-
-