{"id":7647,"date":"2017-07-12T06:00:44","date_gmt":"2017-07-12T10:00:44","guid":{"rendered":"https:\/\/blog.litespeedtech.com\/?p=7647"},"modified":"2017-07-12T06:00:44","modified_gmt":"2017-07-12T10:00:44","slug":"wpw-caching-101","status":"publish","type":"post","link":"https:\/\/lswp.store\/index.php\/2017\/07\/12\/wpw-caching-101\/","title":{"rendered":"WpW: Caching 101"},"content":{"rendered":"<p><a href=\"https:\/\/lswp.store\/wp-content\/uploads\/2017\/07\/wpw09.jpg\"><img fetchpriority=\"high\" decoding=\"async\" class=\"aligncenter size-full wp-image-8156\" src=\"https:\/\/lswp.store\/wp-content\/uploads\/2017\/07\/wpw09.jpg\" alt=\"WordPress Wednesday: Caching 101\" width=\"640\" height=\"320\" srcset=\"https:\/\/lswp.store\/wp-content\/uploads\/2017\/07\/wpw09.jpg 640w, https:\/\/lswp.store\/wp-content\/uploads\/2017\/07\/wpw09-300x150.jpg 300w, https:\/\/lswp.store\/wp-content\/uploads\/2017\/07\/wpw09-600x300.jpg 600w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/a><\/p>\n<p>Welcome to another installment of <a href=\"http:\/\/blog.litespeedtech.com\/tag\/wordpress-wednesday\">WordPress Wednesday<\/a>!<br \/>\nToday&#8217;s Topic:\u00a0<strong>What is Caching?<\/strong><\/p>\n<p>Today we are going to begin a series-within-a-series, and talk about <a href=\"https:\/\/lswp.store\/tag\/caching-101\/\">the basics of caching<\/a>: what is a cache? Why is it beneficial to cache your WordPress site? What types of caching are available to web applications? And then we\u2019ll get into the basics of our own caching solution: LiteSpeed Cache, affectionately referred to as LSCache for short. We\u2019ll also talk about how LSCache is different than other WP caching solutions available, and what that really means for you.<\/p>\n<p>It\u2019s a meaty topic, so we\u2019re going to split it up into a few smaller chunks for easier digestion. Today, let\u2019s start with <b>the basics of web app caching, as they pertain to WordPress<\/b>.<\/p>\n<h2>What is Caching?<\/h2>\n<p>Generally speaking, a cache is a mechanism for storing data in such a way that it is easier or faster to retrieve than the original source.<\/p>\n<p>WordPress sites consist of dynamic pages that are built with PHP. The pages of a WP site don\u2019t exist anywhere in the file system; they are constructed on-demand through PHP, and then served to the visitor as HTML. Along this path, there are a few places that are resource-intensive and ripe for the caching.<\/p>\n<h2>Types of Cache<\/h2>\n<p>Cache can be stored on the visitor\u2019s own device (client side), on the website\u2019s network (server side), or halfway around the world (via a content delivery network). Some sites may employ all of these methods, while others have the need for very few.<\/p>\n<h3>Client-side caching<\/h3>\n<p>All modern browsers support client-side caching. Your browser knows that certain files rarely change. Files like CSS, Javascript, and images can all be stored locally in your browser\u2019s cache so that they can be accessed quickly and easily without being re-downloaded from the server.<\/p>\n<h3>Server-side caching<\/h3>\n<p><img decoding=\"async\" class=\"alignnone\" src=\"https:\/\/lswp.store\/wp-content\/uploads\/2017\/07\/null-1.jpeg\" alt=\"What is Caching\" width=\"672\" height=\"448\" \/><\/p>\n<p>Most of the work of generating and delivering a web page is done on the server side, so it make sense that more of the opportunities to increase efficiency would also be here. There are four major types of server-side caches available to WordPress sites.<\/p>\n<h4>database cache<\/h4>\n<p>A database cache saves time and resources related to the execution of database queries. WordPress relies on its database for basic information about the site, and it asks for this same information often. A database cache stores the query results so that they may be referenced again and again without the need to repeatedly access the database.<\/p>\n<h4>object cache<\/h4>\n<p>An object cache saves time and resources related to the computation of objects. WordPress has a built in object cache mechanism with a defined class and set of functions that can be used to add, access, remove, or otherwise manipulate the object cache. An object cache doesn\u2019t stick around for long. By default, it\u2019s only relevant for the duration of a single request. It\u2019s used to store data that is needed multiple times in a request, but is considered expensive to re-compute. Often, the object cache stores database queries, which is why it is sometimes mistaken for a synonym of \u201cdatabase cache.\u201d<\/p>\n<h4>opcode cache<\/h4>\n<p>An opcode cache saves time and resources related to the execution of PHP code. Before PHP can be executed it must be compiled. An opcode cache stores this compiled code at the server level so that it may be reused without recompiling. The next time a request is sent that requires that PHP code to be executed, it can save the compilation step and just run the code that was saved in the opcode cache.<\/p>\n<h4>page cache<\/h4>\n<p>LiteSpeed Cache is a page cache. Page caches, too, save time and resources, and they do so by storing the full content of dynamically-generated pages so that static copies may be served to the user. A page cache allows the server to bypass PHP and database queries altogether. The other types of cache can be helpful while building up your page cache, but once there is a fresh, well-managed page cache in place, there is little need for database, object, or opcode caches.<\/p>\n<h3>Content delivery networks<\/h3>\n<p>Content delivery networks (or, CDNs) store static website content remotely in servers all around the world. The content may then be served to a site\u2019s visitor from the server that is physically closest to that visitor\u2019s location. The closer the server, the less time the data takes in transit. CDNs are great when it comes to static content, but are lacking when you have a dynamically-generated site such as WordPress, as the content requests must still hit the WP backend.<\/p>\n<h2>Until Next Time&#8230;<\/h2>\n<p>So, there is your overview. At this point, you should understand what types of caching are available for your web apps, and why you might want to use them. Our next article in the <a href=\"https:\/\/lswp.store\/tag\/caching-101\/\">Caching 101 <\/a>series will focus specifically on our solution: LiteSpeed Cache. We\u2019ll talk about how it works, why it\u2019s different than other WordPress page-caching plugins, and what benefits those differences get you. Be sure to meet us back here for that!<\/p>\n<p>&#8212;<\/p>\n<p>Have some of your own ideas for future <a href=\"http:\/\/blog.litespeedtech.com\/tag\/wordpress-wednesday\">WordPress Wednesday<\/a> topics? Leave us a comment!<\/p>\n<p>Don\u2019t forget to meet us back here next week for the next installment. In the meantime, here are a few other things you can do:<\/p>\n<ul>\n<li>Subscribe to the <a href=\"http:\/\/blog.litespeedtech.com\/tag\/wordpress-wednesday\/feed\/\">WordPress Wednesday RSS feed<\/a><\/li>\n<li>Download <a href=\"https:\/\/wordpress.org\/plugins\/litespeed-cache\/\">LiteSpeed Cache for WordPress plugin<\/a><\/li>\n<li>Learn more about the plugin <a href=\"https:\/\/www.litespeedtech.com\/products\/cache-plugins\/wordpress-acceleration\">on our website<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>What is a cache? Why is it beneficial to cache your WordPress site? What types of caching are available for WordPress?<\/p>\n","protected":false},"author":1,"featured_media":8156,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[28],"tags":[54,316,317],"class_list":["post-7647","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cache","tag-caching-101","tag-wordpress","tag-wordpress-wednesday"],"jetpack_featured_media_url":"https:\/\/lswp.store\/wp-content\/uploads\/2017\/07\/wpw09.jpg","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/lswp.store\/index.php\/wp-json\/wp\/v2\/posts\/7647","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lswp.store\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lswp.store\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lswp.store\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lswp.store\/index.php\/wp-json\/wp\/v2\/comments?post=7647"}],"version-history":[{"count":0,"href":"https:\/\/lswp.store\/index.php\/wp-json\/wp\/v2\/posts\/7647\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lswp.store\/index.php\/wp-json\/wp\/v2\/media\/8156"}],"wp:attachment":[{"href":"https:\/\/lswp.store\/index.php\/wp-json\/wp\/v2\/media?parent=7647"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lswp.store\/index.php\/wp-json\/wp\/v2\/categories?post=7647"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lswp.store\/index.php\/wp-json\/wp\/v2\/tags?post=7647"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}