Web cache system
Web Cache system helps improve the performance of Web portals in Cloud-Bricks, decreasing the amount of direct request to databases and web servers by using a proxy reverse

Web cache system allows then to reduce the number of HTTP requests that come to virtual machines, allowing web pages load faster. In the configuration screen of a Virtual Host you can use the "Enable HTTP Cache" checkbox within Location to activate this service. The website will be cached based on his HTTP Headers (Cache-Control ) to generate its pages.

Cache settings in Locations

In the screen of a Virtual Host you can configure different areas of the same web site through the Locations. When inside a Location, the HTTP cache is activated, we have two options according to the cache headers possessing the application.

  • Stale Cache: If the reverse proxy has in memory an already expired copy of a page (ie your cache time has expired) and for some reason it is not possible to obtain an updated copy (Example: the web server is offline), then we authorize the proxy to deliver an "old copy" of the site/page by every request. In this way we can deliver an old copy rather than failing to deliver nothing or generate an error.
  • Cookie no cache: This option is especially useful when the Web site uses an authentication system, and through a specific cookie indicates that the content generated during the session should not be stored in the cache. By activating this option the field appears to enter the name of the cookie.

Cache-control headers

The Cache-Control headers determine the time that the reverse proxy system retain a copy of a particular content in its cache. When a browser requests any content in the proxy, it will deliver content directly from their memory without having to request it again to the virtual machine. The latter will only occur when the cache time set by the Cache-Control header has expired.

Apache Cache-control

Apache is one of the most webserver used, particularly in environments Linux. To activate the cache-control must be loaded mod_cache, mod_headers and mod_expires modules. Enter the Apache configuration file (httpd.conf) and uncomment the lines:

LoadModule expires_module modules/mod_expires.so
LoadModule headers_module modules/mod_headers.so
LoadModule cache_module modules/mod_cache.so

In the same configuration file, in the <Directory> add the cache module parameters:

<IfModule mod_expires.c>
  ExpiresActive On
  ExpiresDefault "access plus 1 seconds"
  ExpiresByType text/html "access plus 1 seconds"
  ExpiresByType image/gif "access plus 120 minutes"
  ExpiresByType image/jpeg "access plus 120 minutes"
  ExpiresByType image/png "access plus 120 minutes"
  ExpiresByType text/css "access plus 60 minutes"
  ExpiresByType text/javascript "access plus 60 minutes"
  ExpiresByType application/x-javascript "access plus 60 minutes"
  ExpiresByType text/xml "access plus 60 minutes"
More about Caching in Apache.

PHP Cache-control

Using PHP every page of the site may have a different cache time. To generate cache headers in PHP to use the header() function. In the following example, the page would be stored for an hour in reverse proxy cache:

Header("Cache-Control: max-age=3600");
//Page content
More about the function Header().

IIS Cache-control (Windows)

With IIS it is possible to control the cache configuration for each site, file extension or directory. In the IIS control panel to enter the site and enter the "Output Caching" option.

Click on the "Add" option.

Edit cache options.

Delete Cache Web

You can delete the web cache of a portal, which is useful if required display a new version of a content immediately. For example if you need to visualize the changes made in an article, deleting the cache are displayed faster changes. To clear the cache web portal to enter the left menu Web System>Web Cache.

Here are two options to clear the cache:

Clear Disk Cache

Clearing the entire disk cache, all the cache in the HTTP servers is deleted, it is task may take some time. This option is recommended when a big change is made throughout the website, for example a change of template.

Delete URL cache

This option is much more specific, and eliminates the cache of objects in a special URL or page. To delete the cache must paste the URL of the article or page for example http://wordpress.pruebas.vnat.net/wordpress/2015/12/11/hello-world/. This option is useful when you need to view content of a recent change.

Other Languages