spring-framework / org.springframework.web.servlet.config.annotation / ResourceHandlerRegistration / setCachePeriod

setCachePeriod

open fun setCachePeriod(cachePeriod: Int): ResourceHandlerRegistration

Specify the cache period for the resources served by the resource handler, in seconds. The default is to not send any cache headers but to rely on last-modified timestamps only. Set to 0 in order to send cache headers that prevent caching, or to a positive number of seconds to send cache headers with the given max-age value.

Parameters

cachePeriod - the time to cache resources in seconds

Return
the same ResourceHandlerRegistration instance, for chained method invocation