Blog

Placester and Web Caching

By Matt Williams

Developers

When we build a site with Placester, we rely on caching to ensure that all of the assets on your site are available as quickly as possible. Ideally, you have W3Total Cache configured with one of its supported caching solutions. If you’re site is hosted with Placester, you have that today as we use W3Total Cache with memcached. But if you don’t use W3TC, we still use a form of caching that leverages your database. Not the best, but better than nothing.

But sometimes you might make a change to your system and not see that change take effect. The reason is sometimes that the cached version of the asset or the data is being served rather than the most current version. So if you are developing Placester sites, its important to understand how to temporarily disable caching.

There are two main options for disabling the cache. You can either do it temporarily for this specific page, or you can do it globally for all pages on the theme or server. The first method involves adding a POST parameter to the URL. Just add no_cache=1 to the end of your URL and you will bypass the cache for that call. For example:

http://www.myrealestatesite.com/search/?no_cache=1 

If you are using the RESTful API, and are making a GET call, you can also add ‘no_cache’ to the parameters for that call.

To disable caching on a more global level, you need to define ‘PL_DISABLE_CACHE’ on either the theme or the server. To do this, edit the functions.php or wp-config.php (functions.php will be at the theme level, wp-config.php will be at the server level). Which ever file you choose, add the following line within the PHP block:

define('PL_DISABLE_CACHE',1);

Now when you visit any page you will get the non-cached version.

If you have any questions about this, leave a comment below.

Comments

Get our Newsletter
Follow Placester