-
Notifications
You must be signed in to change notification settings - Fork 38.6k
Closed
Labels
in: webIssues in web modules (web, webmvc, webflux, websocket)Issues in web modules (web, webmvc, webflux, websocket)type: enhancementA general enhancementA general enhancement
Milestone
Description
Currently we are only able to set size for views cache in subclasses of AbstractCachingViewResolver. When cache size limit is reached, oldest entry is evicted.
In my project I have following access pattern:
- several html views which are accessed frequently
- many RedirectView, which differs only in path segment (
/returnfromsomewhere/SOMEIDENTIFIER
) and are accessed only once. I don't want them to stay in cache.
I added simple view name filter to check if viewName should be cached.
Configuration example:
@Configuration
static class ViewResolverConfiguration {
@Autowired
private List<ViewResolver> viewResolvers;
@PostConstruct
public void configure() {
viewResolvers.forEach(v -> {
if (v instanceof AbstractCachingViewResolver) {
((AbstractCachingViewResolver) v).setCacheFilter(n -> !n.startsWith("redirect"));
}
});
}
}
Is it worth creating PR?
Metadata
Metadata
Assignees
Labels
in: webIssues in web modules (web, webmvc, webflux, websocket)Issues in web modules (web, webmvc, webflux, websocket)type: enhancementA general enhancementA general enhancement