Using Cache-Control headers

The first way, and the one we generally recommend, is to add the Cache-Control header mentioned above. The general format is:

Cache-Control: max-age=num_seconds

where num_seconds is the amount of time in seconds you want the page to last before it expires.

Here is a handy table for those of you who do not have a calculator readily available.

Table 1. Number of seconds in different time periods

Time period

Number of seconds

1 hour

3600

12 hours

43,200

1 day

86,400

1 week

604,800

1 month

2,592,000