Support » Plugin: LiteSpeed Cache » Exclude part of template with ESI from cache

  • Resolved precies



    We have a website build with WordPress and custom made PHP templates.

    I’m reading and searching a lot on the internet for a solution to make a “fragment” of our template “not cachable” or at least set a different TTL.

    Now I read a lot about ESI but I don’t know how to use it in my specific situation.

    To give you an example:

    <!doctype html>
    <meta charset="utf-8">
    	<div class="public-cache">
    		<p>This content is public and part of the whole site cache</p>
    	<div class="private-cache">
    		<p>This content is PRIVATE and should be cached with another TTL</p>

    How can I made a part of my template code (div) not part of the public cache and give it another TTL?

    Is something like this even possible like this?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Support qtwrk


    Thread Starter precies



    Thank you so much for this article. I managed to set it up like you set but for some reason the TTL is not working.

    I set it to 300 (thats like 5 minutes right?) but on every page refresh the Block is generated again.

    <!– Block generated by LiteSpeed Cache 4.4.3 on 2021-10-26 09:04:11 –>

    I get this comment and on every refresh the time changes. So the function is working and it is not part of the other cache anymore but the TTL is not working either. Any idea why the TTL is not working. I used it like this:

    function my_esi_block_esi_load()
    do_action( 'litespeed_control_set_ttl', 300 );

    Also is there a way to hide the comment that is generated now?

    Plugin Support qtwrk


    I think this is a bug , reported to dev for further investigation

    Thread Starter precies



    Thank you for your response. Do you have any idea when you get back from dev?
    Maybe you can leave the threath open until there is a solution so you can share this with me?:)

    Plugin Support usabe


    Hello @precies

    Could you please open a ticket here?

    This function has been there for a while and we didn’t get report regarding this. Not sure how you implement this exactly. We may need to check into your site and server further for investigation.

    Please mentioned this post in the ticket and you can ask to assign your ticket to Abe.

    Best regards,

    Thread Starter precies


    Thank you for getting back to me. Was a little busy so did not had the time to submit a ticket.

    I just did so hopefully we can solve this:)

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Exclude part of template with ESI from cache’ is closed to new replies.