Cache servers depend on cache control headers provided by the web server. Essentially, the web server (based on the configuration) specify’s what content is cache-able and for how long. (Note: Some of the cache servers might ignore this and have a default cache period for specific content. But that is not for another post 🙂 )
Here is a quick and dirty way to configure Apache 2.x server to enable cache control settings on all content in a directory
[bash]
ExpiresActive On
<Directory "/var/www/html/static">
Options FollowSymLinks MultiViews
Order allow,deny
Allow from all
ExpiresDefault "modification plus 1 hour"
</Directory>
[/bash]
This configuration tells apache to enable cache headers for all content in the /var/www/html/static folder. The cache expiration is set to expire 1 hour from the modification time of the content.