Differences

This shows you the differences between two versions of the page.

Link to this comparison view

litespeed_wiki:cache:plugin-benefits [2018/01/11 20:39]
Lisa Clarke created
litespeed_wiki:cache:plugin-benefits [2018/01/11 21:17] (current)
Lisa Clarke
Line 1: Line 1:
 ====== Why LSCache Plugins are Better Than Rewrite Rules ====== ====== Why LSCache Plugins are Better Than Rewrite Rules ======
  
-Rewrite ​Rules can be used to configure LSCache, but if there is [[litespeed_wiki:​cache#​lscache_plugins_by_application|a plugin available]] for your web application,​ we strongly recommend you use the plugin.+Rewrite ​rules can be used to configure LSCache, but if there is [[litespeed_wiki:​cache#​lscache_plugins_by_application|a plugin available]] for your web application,​ we strongly recommend you use the plugin.
  
-**Why?**  +===== Why? (The Short Answer) =====
- +
-Here's the short answer:+
  
 With rewrite rules, there is no ability to purge the cache, and so you can only cache items for a very short time, otherwise you run a great risk of serving stale content. Plugins have more cache-management controls, including the ability to purge the cache at will. With rewrite rules, there is no ability to purge the cache, and so you can only cache items for a very short time, otherwise you run a great risk of serving stale content. Plugins have more cache-management controls, including the ability to purge the cache at will.
  
-The long answer will require some more writingIt'​s ​coming soon.+===== Why? (The Longer Answer) ===== 
 + 
 +====Smart Purge==== 
 +This is the most compelling reason to choose a plugin over rewrite rules: Smart Purge technology. 
 + 
 +When content in your web application changes, an LSCache plugin is able to analyze dependencies and trigger a cache purge not only for the content that has changed, but for //all other content that is related to it//. In WordPress, that means that a new blog post triggers a cache purge for the relevant category and tag archive pages. In PrestaShop, that means that a change in a product'​s ​stock level triggers a purge of that product'​s detail page as well as the product'​s category pages. 
 + 
 +With rewrite rules, the cache is only emptied when the TTL (Time to Live) is expired. 
 + 
 +====Stable Content==== 
 +Let’s say that we were to cache a page with a TTL of one week. No matter the level of traffic - one request per hour or 500 requests in a 10-second period - a single hit to the back-end during that //entire week// is all that would be necessary. We can set such a long TTL confidently with an LSCache plugin, because we know if content changes, Smart Purge will kick in and trigger any necessary purges. 
 + 
 +We have no such assurances with rewrite rules, and so, we must keep the TTL relatively short in order to avoid the possibility of serving stale content. 
 + 
 +Because of these short TTLs, rewrite-rule-based caches must re-cache frequently, even if content is relatively stable. Blindly re-caching content in this way leads to wasted CPU resources. 
 + 
 +====Varying Types of Content==== 
 +A plugin can distinguish between private content and public content, whereas rewrite rules cannot.Additionally,​ LSCache plugins have the ability to use ESI to serve private blocks of data within public pages, which means we can easily serve cached pages to logged-in users. 
  • Admin
  • Last modified: 2018/01/11 20:39
  • by Lisa Clarke