Class RedirectCache.Default
java.lang.Object
org.eclipse.jetty.client.RedirectCache.Default
- All Implemented Interfaces:
RedirectCache
- Enclosing interface:
RedirectCache
Default implementation of RedirectCache.
This implementation only caches permanent redirects
corresponding to HTTP statuses 301 and 308.
This implementation uses a configurable size-bounded LRU cache.
-
Nested Class Summary
Nested classes/interfaces inherited from interface RedirectCache
RedirectCache.Default, RedirectCache.MethodOriginTarget -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clears all cached redirects.get(RedirectCache.MethodOriginTarget original) Returns a cached redirect for the given method and URI.voidput(RedirectCache.MethodOriginTarget original, int status, RedirectCache.MethodOriginTarget redirect) Caches a redirect.intsize()
-
Constructor Details
-
Default
public Default(int maxSize) Creates a cache with the specified maximum size.- Parameters:
maxSize- the maximum number of entries (must be positive)
-
-
Method Details
-
get
Description copied from interface:RedirectCacheReturns a cached redirect for the given method and URI.
- Specified by:
getin interfaceRedirectCache- Parameters:
original- the original method and URI- Returns:
- the redirect method and URI, or
nullif not found
-
put
public void put(RedirectCache.MethodOriginTarget original, int status, RedirectCache.MethodOriginTarget redirect) Description copied from interface:RedirectCacheCaches a redirect.
- Specified by:
putin interfaceRedirectCache- Parameters:
original- the original method and URIredirect- the redirect method and URI
-
size
public int size()- Specified by:
sizein interfaceRedirectCache- Returns:
- the number of cached redirects
-
clear
public void clear()Description copied from interface:RedirectCacheClears all cached redirects.
- Specified by:
clearin interfaceRedirectCache
-