Cachesecond in Spring module
I am currently new to web programming and is trying out to learn spring framework. I have basic understanding on Servlets and 开发者_如何学JAVAJSP.
Currently, I am confused on the property cacheSecond on the Spring Controller. Can anybody point me to resource where I could understand below concepts?
I made some reading on browser caching but I am not sure if this is the same as the Response Caching being mentioned in the Spring documentation
This is documented in the API:
Cache content for the given number of seconds. Default is -1, indicating no generation of cache-related headers.
Only if this is set to 0 (no cache) or a positive value (cache for this many seconds) will this class generate cache headers.
The headers can be overwritten by subclasses, before content is generated.
This relates only to the HTTP cache headers, affecting browser behaviour. It has nothing to do with server-side response caching.
Incidentally, if you're just learning Spring, I recommend avoiding the Controller class hierarchy, which dates back to Spring 2.0, and focus instead on Spring 2.5-style annotated controllers. It's more intuitive and flexible, and is the recommended way to write Spring MVC apps now.
精彩评论