Periodically Clearing the Server-Side Cache

The Webvanta system caches pages on the server, so most accesses to a page do not incur the delay of generating the page dynamically. For complex pages, this yields a large performance improvement.

The cache is automatically cleared when you change database content or make various other changes. See Understanding Webvanta's Caching System for details on the caching system and some tips on optimizing its performance.

There are some situations in which the built-in automatic cache clearing is not enough. The most common case is when you are using a date comparison, such as in this example:

<w:kb:item:each type="custom_events" condition="start_date > now">
   (code that displays the events goes here)

This page's cache will not be automatically cleared when events are in the past, because no change occurs in the database; the caching system cannot automatically evaluate the conditions on every iterator on every page each time the page is accessed.

(Note that the cache is cleared any time you edit an event, but not when the only change is that time has passed so the value of "now" is different.)

Using the Cache Sweeper Configuration

You can cause the cache for a page with date-dependent information to be automatically cleared by using the cache sweeper configuration setting.

Add a global setting named admin.cache.cache_sweeper_config.

There are two options for the value of this setting:

  • "Easy mode": Set the value of this setting to "true" (don't enter the quotes) to have the entire site's cache cleared every 24 hours.
  • "Advanced mode": Set the value of this setting to a JSON string that specifies what pages are to be cleared every 24 hours.

When using the advanced mode, the JSON string is formatted as follows:


For example, to clear the home page and the events page cache: