Class CachingResourceManager
java.lang.Object
io.undertow.server.handlers.resource.CachingResourceManager
- All Implemented Interfaces:
ResourceManager,Closeable,AutoCloseable
- Author:
- Stuart Douglas
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intMax age 0, indicating that entries expire upon creation and are not retained;static final intMage age -1, this force manager to retain entries until underlying resource manager indicate that entries expired/changedFields inherited from interface io.undertow.server.handlers.resource.ResourceManager
EMPTY_RESOURCE_MANAGER -
Constructor Summary
ConstructorsConstructorDescriptionCachingResourceManager(int metadataCacheSize, long maxFileSize, DirectBufferCache dataCache, ResourceManager underlyingResourceManager, int maxAge) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()intlongReturns a resource for the given path.voidvoidinvalidate(String path) booleanvoidRegisters a resource change listener, if the underlying resource manager support itvoidRemoves a resource change listener
-
Field Details
-
MAX_AGE_NO_CACHING
public static final int MAX_AGE_NO_CACHINGMax age 0, indicating that entries expire upon creation and are not retained;- See Also:
-
MAX_AGE_NO_EXPIRY
public static final int MAX_AGE_NO_EXPIRYMage age -1, this force manager to retain entries until underlying resource manager indicate that entries expired/changed- See Also:
-
-
Constructor Details
-
CachingResourceManager
public CachingResourceManager(int metadataCacheSize, long maxFileSize, DirectBufferCache dataCache, ResourceManager underlyingResourceManager, int maxAge)
-
-
Method Details
-
getResource
Description copied from interface:ResourceManagerReturns a resource for the given path. It is the responsibility of the called to make sure that the path in Canonicalised.- Specified by:
getResourcein interfaceResourceManager- Parameters:
p- The path- Returns:
- The resource representing the path, or null if no resource was found.
- Throws:
IOException
-
isResourceChangeListenerSupported
public boolean isResourceChangeListenerSupported()- Specified by:
isResourceChangeListenerSupportedin interfaceResourceManager- Returns:
trueif a resource change listener is supported
-
registerResourceChangeListener
Description copied from interface:ResourceManagerRegisters a resource change listener, if the underlying resource manager support it- Specified by:
registerResourceChangeListenerin interfaceResourceManager- Parameters:
listener- The listener to register
-
removeResourceChangeListener
Description copied from interface:ResourceManagerRemoves a resource change listener- Specified by:
removeResourceChangeListenerin interfaceResourceManager
-
invalidate
-
invalidate
public void invalidate() -
getMaxFileSize
public long getMaxFileSize() -
getMaxAge
public int getMaxAge() -
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-