-
public interface Cache
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceCache.CacheBuilderstatic interfaceCache.CacheEntrystatic interfaceCache.CacheStatsstatic classCache.DiskCacheBuilderThe builder for in persistent cache.static classCache.EncryptedDiskCacheBuilderTheCache.DiskCacheBuilderthat will createCachethat maintains all files in encrypted manner.static classCache.InMemoryCacheBuilderThe builder for in memory cache.static 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.DiskCacheBuildernewDiskCacheBuilder()Creates a newDiskCacheBuilderinstance.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.Cache.CacheStatsstats()Gets the statistics for 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.
-
newDiskCacheBuilder
static Cache.DiskCacheBuilder newDiskCacheBuilder()
Creates a newDiskCacheBuilderinstance.- Returns:
- the new
DiskCacheBuilder.
-
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.
-
stats
Cache.CacheStats stats()
Gets the statistics for this cache.- Returns:
- The statistics for this cache.
- See Also:
Cache.CacheStats
-
writer
<T> Cache.Writer<T> writer(CacheEntryMetadata metadata)
Creates aWriter.- Type Parameters:
T- The response body type.- Parameters:
metadata- The metadata.- Returns:
- a
Writer.
-
-