Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Meaning of cacheSeconds in AbstractController

Posted on 2014-04-04
1
Medium Priority
?
466 Views
Last Modified: 2014-04-14
Hi,
what does cacheSeconds when we extend an Abstract Controller.
I found some explanation here -
http://docs.spring.io/spring/docs/2.5.x/api/org/springframework/web/servlet/mvc/AbstractController.html

But couldnt understand it. Please provide some example with explanation.

What is a cache header or header and its use ?

Thanks
0
Comment
Question by:Rohit Bajaj
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 35

Accepted Solution

by:
girionis earned 2000 total points
ID: 39988094
This property indicates to the client how long for it should cache the content.

cacheSeconds = -1 means that no headers will be generated.
cacheSeconds = 0 means that no caching is allowed.
cacheSeconds > 0 means that the controller will send the appropriate headers to indicate that the content shall be cached for that many seconds.

For example with cacheSeconds = 0 the controller will send the following with the response

Pragma: No-cache
Expires: n (where n is the current system date + 30, as HTTP formatted date) (HTTP/1.0)
Cache-Control: no-cache (HTTP/1.1)
Cache-Controle: no-store (HTTP/1.1, for Firefox)

Open in new window


With cacheSeconds = 30 the controller will send the following with the response

Expires: n (where n is the current system date + 30, as HTTP formatted date) (HTTP/1.0)
Cache-Control: max-ages=30 (where the max-ages is the time the content should be cached for) (HTTP/1.1)

Open in new window


Note that the client might ignore all of these headers, so setting them hints to the client your intention, it does not instruct it.

For more information you can read the book "Expert Spring MVC and Web Flow"
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Suggested Courses

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question