Using ESI in Joomla with LSCache
This is the second installment lesson of Joomla.
The topic for today is ESI in Joomla.
We have already spoken about how to set up a private cache for your Joomla site. Now, we'll go a step farther and look into ESI, or "Edge Side Includes." ESI combines the principles of public cache and private cache in a way that allows you to deliver cached material to a greater number of visitors, whether logged in and out.
What is ESI?
An example of a mark-up language is the ESI mark-up. It allows you to split down aspects of your dynamic website into individual sections that are then put together to form the whole page. ESI allows you to "punch holes" in a page and fill them with content that has to be cached differently than the rest of the page.
For example, ESI blocks can have variable TTLs and can be erased by events unrelated to the page they're on. ESI blocks can also include private information, even if the page they're on is publicly cached. You can cache more of your site for more users because of this flexibility. ESI should be a major component of any ecommerce caching strategy.
How do ESI and Public/Private Cache Work Together?
You can disassemble a full page using ESI and treat the individual pieces differently.
With LiteSpeed Web Server, you may store data in both public and private caches.
These two features work together to produce a system that can partition a page into public and private pieces, correctly cache each section, reconstruct the full-page content from the required caches, and serve it to a user without ever touching the PHP backend.
That is just amazing!
Enabling and Configuring ESI:-
When you enable ESI, you're allowing holes to be punched for material that will be cached either privately or publically with its own TTL, or not at all.
While it is possible to leave an ESI block un-cached, it is not advised. Each time an un-cached module is requested, PHP must be invoked. PHP consumes a lot of resources and significantly slows down your page. You should avoid using the PHP backend if at all possible.
Rendering Modules as ESI:-
If you want, any module can be turned into an ESI block. It's a wonderful fit for modules. They're already self-contained code snippets.
Choose which modules you want to render as ESI blocks.
ESI is a suitable fit for the following types of modules:
- Any module that provides customized data
- Any module that shows distinct content to logged-in and logged-out users
- Modules with regularly changing information in comparison to the rest of the site
We've used the Login Form and User Menu in this example, but you can use any modules that make sense for your installation.
Render Modules as ESI by pressing the Render Modules as ESI button.
The most important fields here are ESI Module Cache Type and ESI Module Cache Timeout, and how you set them is entirely depending on the module's role.
Let's have a look at the two modules we'll be assembling. Because we'll be using ESI for two separate purposes, we'll configure it differently for them. We're using the same two modules as in the previous example.
Frequently Changing Content & Private Content on a Public Page:-
- Using ESI for Frequently Changing Content:-
On sites that change infrequently, an ESI module can be used to display continually changing content.
Because the "Latest Articles" module always contains public data, we may set the ESI Module Cache Type to Public. We want to use ESI for this module because we have an active site with new information being updated every hour or so. To ensure that the module is always up to date with the latest articles, we set the ESI Module Cache Timeout to '60' minutes.
We can now change the site's Public Cache TTL to a week, which is more appropriate for a site with rarely-changing pages.
- Using ESI for Private Content on a Public Page:-
We can use an ESI module to punch a hole for private information on a public page.
The "Login Form" module says one thing while the user is logged out, but another when the user is logged in. As a result, you should set the ESI Module Cache Type to Private. The remainder of the options can be ignored.
When a person logs in, there's no need to serve everything from the private cache. We can serve all of the pages from the public cache and simply poke holes in the hidden content of the "Login Form" module.
So, what are your thoughts? Would you like to try out ESI on your website?
In a number of challenging situations, ESI gives you the ability to cache more of your site. You may deliver cached material to a larger percentage of your users and keep everything operating swiftly and efficiently with pages that mix and match private/public cache or differing TTLs.
With Red Talker Hosting, you can develop a unique brand identity, enhance brand recognition, generate highly relevant leads, and raise sales like crazy with our specialized digital marketing services. We're a well-known digital marketing agency specializing in web design and development, SEO, PPC, branding, and content marketing. We also provide full-service business web hosting and cloud servers.