• Resolved 9itish

    (@9itish)


    Hi,

    A couple of pages contain a section on my website where content is fetched in random order. The pages are cached for 24 hours.

    Here is an example. A visitor on my website goes to page “X”, he sees 5 random posts in the sidebar. All non-admin visitors on page “X” will see the same 5 random posts for next 24 hours. After that LiteSpeed will purge the page cache and new set of 5 random posts will be visible in the sidebar.

    However, if an Admin visits page “X”, he will see 5 different random posts in the sidebar on each reload. It seems like the pages are not cached for Admin. Is there any setting that I can change to also cache all pages for 24 hours for the admin?

    This way I can make sure that the content I see as Admin is the same content that is visible to my website visitors.

    Thanks.

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

    (@qtwrk)

    Hi,

    Did you enable ESI feature ?

    and how does that “random post” set up ? it’s like a widget or something ?

    Best regards,

    Thread Starter 9itish

    (@9itish)

    Hi @qtwrk,

    ESI is turned off on the website.

    However, the value of Admin Vary Group is set to 99 on the same page while all other groups have a value of 0. LiteSpeed Cache says that “If your site contains public content that certain user roles can see but other roles cannot, you can specify a Vary Group for those user roles. For example, specifying an administrator vary group allows there to be a separate publicly-cached page tailored to administrators (with “edit” links, etc), while all other user roles see the default public page. ”

    So, is a non-zero value for Admin Vary Group responsible for creation of non-cacheable pages?

    The generated HTML of each page visited by an Admin has the following at the bottom:

    <!-- Page uncached by LiteSpeed Cache 2.9.9.2 on 2020-01-29 15:44:19 -->.

    On the other hand, a page visited by non-admin has the following at the bottom:

    <!-- Page generated by LiteSpeed Cache 2.9.9.2 on 2020-01-29 15:45:18 -->.

    how does that “random post” set up? It is a function in my functions.php which
    picks up five random posts to display on each page using WPQuery.

    Thanks.

    • This reply was modified 5 years, 1 month ago by 9itish.
    Plugin Support qtwrk

    (@qtwrk)

    Hi,

    If that function is dynamic generated content , then I think in this case , the ESI is the only solution.

    Otherwise you can not have the page cached , which defeats the purpose for using caching plugin.

    Please use LSCWP API to make that function to become an ESI block

    once it becomes an ESI block , the whole page will be cached, except that block which can be set to dynamic generated content or shorter-cached TTL to fit your needs.

    Best regards,

    Thread Starter 9itish

    (@9itish)

    @qtwrk It seems like there has been a misunderstanding. ??

    Either I did not understand your last response or I failed to explain my problem clearly at the beginning.

    I WANT the randomly generated content to be cached for everyone for 24 hours. It IS being cached for non-admin users.

    However, it is NOT CACHED for admin users. How can I also TURN THE CACHE ON for Admin Users.

    It is not just about the randomly generated sections. NOTHING is cached for Admin users. Is this intentional in LiteSpeed Cache to always serve fresh content to Admins?

    How can I turn on the Cache for Admins?

    Thanks.

    Plugin Support qtwrk

    (@qtwrk)

    Hi,

    My bad.

    By default admin is also cached when visit in front end pages.

    Please check if you have set “Do Not Cache Roles” set to admin.

    Best regards,

    Thread Starter 9itish

    (@9itish)

    Hi qtwrk,

    Everything is un-selected under “Do Not Cache Roles”. This includes Admin, Author, Contributer, Editor, Subscriber.

    I have set default public Cache TTL to 86400 seconds and Private Cache TTL to 1800 seconds.

    Cache Logged in users is also turned On.

    Plugin Support qtwrk

    (@qtwrk)

    Hi,

    OK , then please enable debug log to your IP

    debug log should tell you the reason why page is uncached

    Best regards,

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Litespeed Always Shows Uncached Pages for Admin’ is closed to new replies.