Caching is a vital factor in improving a website’s overall performance. In WordPress this is especially true since the CMS creates HTML pages dynamically. PHP code working with MySQL database queries create the live site pages that a visitor experiences.
Wordpress caching can reduce load time by seconds and improve the performance of a website and web hosting server. Shaving off website load time can help improve the user-experience of your site and make search engines happier.
WordPress has an internal cache, and web developers or site owners can install a third-party cache system. All functions of the cache are documented in the Wordpress Codex. All functions can be found in wp-includes/cache.php file.
WordPress implements two different caching methods.
For example: below is the function for resetting the cache:
/**
* @param int|string $key The cache ID to use for retrieval later
* @param mixed $data The data to add to the cache store
* @param string $flag The group to add the cache to
* @param int $expire When the cache data should be expired
*/
wp_cache_add($key, $data, $flag = '', $expire = 0)
Below are three simple tips for speeding up larger enterprise websites. For many small websites, caching may be enough to shave off load time. Larger websites may need a little more help, including:
SOURCE: Wordpress Codex: https://codex.wordpress.org/Class_Reference/WP_Object_Cache