fbpx
🤝 CYBER MONDAY & FRIDAY SALE RETURNS - 50% OFF all plans! 🤝 Grab it Now

ajax cached by litespeed cache automatically cleared after 3600s

VU Cong

Hi team

I checked and the ajax is cached by litespeed cache. However, only 3600s later, this cache was automatically deleted and had to be cached from the beginning. So the server becomes very slow again.

Looks like variation swatch cleared the entire page cache and I had to cache it all over again 🙁

https://prnt.sc/066kURz2JorR

https://prnt.sc/DwXwh_rn4mYk

https://prnt.sc/DZIzkFIqefl-

Thank You

Hakik Zaman

Hi VU,

Thanks for getting back to us. The screenshot you gave is not related to LiteSpeed Cache.

These are from the browser locale. We keep variation data in the user locale for one hour.

We clear it for that specific user, who is visiting your site. For best caching support, please enable object cache if your hosting support it.

I hope it will clear up your confusion.

Thank You

VU Cong

Hi Zalman

In my opinion, variation data ajax should be cached forever, it is only cleared when I clear cache at litespeed. Why do you delete it after 1 hour?

Thank You

Hakik Zaman

Hi VU,

In my opinion, variation data ajax should be cached forever

As I said before we cleared the browser locale cache after 1 hour. We don’t clear your LiteSpeed cache.

It shouldn’t be cached forever cause you may add new variations or new products. What will happen if it loaded the data from the cache, not the new product inserted?

Thank You

VU Cong

Hi Zaman,

I have tested and my pages cache is cleared. I don’t know why either

Because currently cache is only for 1 hour, after 1 hour all ajax will cache again leading to CPU Overload because each product has variation is 1 request, assuming there are 20 products with vairiation corresponding to 20 requests/1 user => FULL CPU

In my opinion, you should not automatically clear the cache but let it clear it manually. When adding new variation or new product, we will clear the cache in the litespeed section, so it will be more reasonable

Thank You

Hakik Zaman

Hi VU,

I am saying the same thing. It cached in an individual user’s browser locale. How do you clear your customer’s computer cache?

It does not seem like a good solution. I have already said if you want good caching support, you can use the server-side object cache. It will decrease your server load.

Thank You

VU Cong

Hi Zaman,

Let me ask you a question.

Why don’t you cache it on litespeed but save it in user locale. If saved on litespeed, all users can access the cache without having to reload after 1 hour like when saving in user locale

Thank You

Hakik Zaman

Hi VU,

Why don’t you cache it on litespeed but save it in user locale.

It is difficult to say that all the other users will also use the LiteSpeed cache. So, we can’t depend on the LiteSpeed cache.

BTW, we have introduced an option to load data without hitting API requests. Check this screenshot: https://paste.pics/MR04D

Increase the value as per your variations on the archive page. If you set the value to 10, it will not send an API request for the product which has 10 variations. It will bring data as an HTML attribute.

Thank You

VU Cong

Hi Zaman,

I just used this feature.

Compared to using API requests, using HTML Attribute does not use much server cpu, TTFB does not increase (like the old versions before API Request) and can use cache without having to run ajax anymore.

The feature is great, however I haven’t realized the downside of this feature yet. Can you tell me the disadvantages of using HTML Attribute compared to API Request or compared to the older version when API Request is not used (then TTFB is very high, increase 3-5s)

Thank You

Hakik Zaman

Hi VU,

The feature is great, however I haven’t realized the downside of this feature yet.

Using this feature, the page will load after getting all the HTML markups including our swatches markup. This may take time who has lots of variations like 300 or 500 for each product.

Using API, the page will load without waiting for the swatches data.

I hope it will help you to understand the workflow.

Thank You

VU Cong

Hi Zaman,

Ok I understood.

However, using this HTML Attribute is different from the way you did it before.
Previously this plugin also did not use API that would load all information of variation swatches but TTFB will increase 3-5s. Currently I check the TTFB of the website it is not as high as before. Why is that?

Thank You

Hakik Zaman

Hi VU,

TTFB depends on many other things. Please check the full details of the report to understand.

Thank You

VU Cong

Hi Zaman,

I checked, when I enabled both Variation Swatch and Litespeed Cache plugins, some of my wp-admin pages were cached locally for 3600s. All my settings in the other plugin are cached and I can’t save the changes because it will reload the cached data.

You can see an example like on the picture below:

https://prnt.sc/kw6YtartvAXa

How can I fix this?

Thank You

Hakik Zaman

Hi VU,

Please temporarily disable the Swatches plugin and check if it is cached or not.

From your screenshot, where did you find it is cached for 3600s 🤔?

I can see the max-age = 0 https://paste.pics/N5M31

Thank You