Placester and Web Caching
By Matt Williams
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:
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:
Now when you visit any page you will get the non-cached version.
If you have any questions about this, leave a comment below.
Published on November 20, 2013
Written by Matt Williams
I am all about getting developers excited and efficient at using the Placester platform. To achieve this, I write blog posts, film videos, create code samples, and answer all of the more technical questions that come in our our support lines. Before joining the team at Placester, I held similar roles at Yottaa, Open Text, Microsoft, along with consulting roles at Oracle, Sun, Intel, IBM, and many others.