spring-framework / org.springframework.web.servlet.mvc / WebContentInterceptor / addCacheMapping

addCacheMapping

open fun addCacheMapping(cacheControl: CacheControl, vararg paths: String): Unit

Map specific URL paths to a specific org.springframework.http.CacheControl.

Overrides the default cache seconds setting of this interceptor. Can specify a empty org.springframework.http.CacheControl instance to exclude a URL path from default caching.

Supports direct matches, e.g. a registered "/test" matches "/test", and a various Ant-style pattern matches, e.g. a registered "/t*" matches both "/test" and "/team". For details, see the AntPathMatcher javadoc.

NOTE: Path patterns are not supposed to overlap. If a request matches several mappings, it is effectively undefined which one will apply (due to the lack of key ordering in the underlying java.util.HashMap).

Parameters

cacheControl - the CacheControl to use

paths - URL paths that will map to the given CacheControl

Since
4.2

See Also
#setCacheSecondsorg.springframework.util.AntPathMatcher