gantry5 icon indicating copy to clipboard operation
gantry5 copied to clipboard

News Slider particle or particle-module does not clean cache

Open danjde opened this issue 4 years ago • 25 comments

Hi Devs, I'm using Gantry 5.4.34 and Notio 1.2.4 on Joomla 3.9.20, php 7.3, mysql Ver 15.1 Distrib 10.3.18-MariaDB, Apache 2.4.38-3. In this context I found that the News Slider, particle or particle-module is unable to update images related to new content, when the new content are Joomla article category.

The problem is related to the cache, that is not cleanable by the Joomla general removal system (system -> clear cache), but only from the Template (Extras -> Clear Cache). Cleaning cache form template allows the slider content updating.

The template is in production mode and Joomla using 15 min cache (memcached or file).

I've try using News Slider ad particle and module-particle with cache enabled, but the behavior is the same.

Now I'm try to see what happens using News Slider as module-particle with cache disabled.

Here the Rockettheme ticket: https://rockettheme.com/forum/joomla-template-notio/284856-news-slider-does-not-show-the-last-image-content

Thanks

Davide

danjde avatar Aug 14 '20 18:08 danjde

Hi Devs, I've try with module-particle with cache disabled, nothing change. The behavior is the same.

danjde avatar Aug 19 '20 09:08 danjde

As I already said in ticket... When you go to "production mode" then any changes in SCSS YAML or TWIG will not be detected as everything is cached. If you want automatic detection of changes (which is slower) then you should be using "development" mode.

http://docs.gantry.org/gantry5/configure/extras

2020-08-19_11-42-00

marktaylor46 avatar Aug 19 '20 10:08 marktaylor46

...but are you telling me that to make a slider working I should slow down the whole website?!?!? But are you kidding right? But do you think if I install a different slider I should disable the Joomla or template cache?? The answer is clearly no! Because no one would ever dream of doing such a thing. I'm speechless...

danjde avatar Aug 19 '20 11:08 danjde

Ok, clearly I'm not helping here with my explanations of the Gantry 5 docs - so I'll leave it for someone else to answer.

Incidentally the newsslider.yaml does have the caching option set to "static" (which I do believe is incorrect) but even if you remove that option from the yaml it makes no difference, "production" mode - cache content, no checks for changes. "development" mode - check for changes and rebuild content if necessary (i.e. slower).

Good luck with your resolution.

marktaylor46 avatar Aug 19 '20 11:08 marktaylor46

Well, thanks for your help, and we await Devs response ;-)

danjde avatar Aug 19 '20 13:08 danjde

@danjde This issue was discussed a while back in 2018. You can read the thread on it here. https://github.com/gantry/gantry5/issues/2391 You could try creating an override of the particle to see if that helps. To do this you need to remove the caching part in the YAML file.

configuration:
  caching:
    type: static

Also, in case it helps or applies to your issue, there was another ticket regarding static Joomla function calls in twig. https://github.com/gantry/gantry5/issues/874

Last but not least, I'd be remiss if I didn't mention the Joomla extensions from Kubik-Rubik. In your Rocket Theme ticket you asked:

Is it possible schedule a cron to delete periodically the template cache?

As long as you have the ability to create cron jobs then you can use one of these 2 extensions to clean the cache.

Page Cache Extended https://kubik-rubik.de/pce-page-cache-extended

Quick Cache Cleaning https://kubik-rubik.de/qcc-quick-cache-cleaning

Each one allows you to set a Token so you can clean the cache of the front-end of the website. Page Cache Extended has an extra option where you can choose to clean all the cached files or you can set it to clean only the loaded page. So depending on how you are using the news slider you could, say it is only on your home page, you could setup the cron to clean only the home page leaving the rest of the cached files intact.

There are free versions available but also pro versions with extra functionality. The Pro versions are well worth the subscription price as you get access to all the Pro versions of the extensions with just 1 subscription.

One last thing, Page Cache Extended works great when used in combination with 2 other Kubik-Rubik extensions, Easy Performance Booster & Device Specific Content.

Good luck and let me know if you have any questions implementing my suggestions.

regards

N8Solutions avatar Aug 20 '20 08:08 N8Solutions

@N8Solutions I did test the removal of that static caching option (which I do think is incorrect) on the casestudies particle and it made absolutely no difference - production mode will cache the twig output from the particle.

marktaylor46 avatar Aug 20 '20 09:08 marktaylor46

I've try, changing the 4 cache types:

    static - never updates, cached forever
    menu - because of issues, commented out in the code
    config_matches - static caching, but allowing particle option to control it
    (disabled) - never cached

nil

I've try, Installing Page Cache Extended, and using the option "Clean Cache Token"

nil

Now stop, it seems to me to change the slider the only way possible..

Thanks again!

Davide

danjde avatar Aug 21 '20 13:08 danjde

@danjde I can say without a doubt that the Page Cache Extended & Quick Cache Cleaner extensions will most certainly clear the cache if you are using them correctly. I use them on my own websites which are also all built with Gantry 5 in production mode. So either a) you are using them incorrectly with the cron job b) you are using a CDN that is caching your files which is causing your site not to be updated because the CDN is loading the cached content. c) there is an issue with your website.

N8Solutions avatar Aug 21 '20 13:08 N8Solutions

a) you are using them incorrectly with the cron job

Yes, it could be. What should it be the right "frontend clean cache "path"? The following is it correct?

www.mysite.com/?cleancache=TOKEN

Again, is it necessary to install "Quick Cache Cleaning" too, or could I run via cron "PCE - Page Cache Extended" fontend clean cache?

Thanks again!

danjde avatar Aug 23 '20 14:08 danjde

Now, I've installed "Quick Cache Cleaning" and set to clean cache on save content, I will see...

Thanks again!

danjde avatar Aug 23 '20 15:08 danjde

Here I am! I've installed QCC, and even just enabling the backend administrator module, and also disabling the plugin, this solve the issue. You don't need to do anything else and not even act manually from the module. Probably the module hooks the slider cache and makes it reachable and erasable from the native Joomla system cleaning cache.

Thanks

danjde avatar Aug 27 '20 13:08 danjde

Changing the cache to not to be static should help to fix the issue (just remove the lines) -- but in addition, Joomla modules also have caching, so you should change caching settings from there, too.

mahagr avatar Sep 01 '20 14:09 mahagr

@hexplor @simmonsr Can you make the particle not to use static caching?

mahagr avatar Sep 02 '20 12:09 mahagr

I tried that change myself on my own local copy and it made absolutely no difference.

marktaylor46 avatar Sep 02 '20 12:09 marktaylor46

I tried that change myself on my own local copy and it made absolutely no difference.

I too, none changes.

danjde avatar Sep 09 '20 17:09 danjde

I just tested changing the caching (in particle yaml file and in module settings) and I have no issues at all. Content gets updated every time I make a change to Joomla articles.

mahagr avatar Oct 05 '20 11:10 mahagr

@simmonsr You need to update the particle yaml and remove configuration > caching to make it to update on every page load.

mahagr avatar Oct 05 '20 11:10 mahagr

Confirmed - I can't reproduce this either now - as long as you remove the "caching static" from the newsslider.yaml it then works as expected.

So it's just the particle yaml that is incorrect.

marktaylor46 avatar Oct 05 '20 13:10 marktaylor46

So just News Slider particle? We are using the following in several particles:

configuration:
  caching:
    type: static

simmonsr avatar Oct 05 '20 14:10 simmonsr

I'd say... "any particle that can source data from the CMS, rather than just particle datasource should never use static caching".

marktaylor46 avatar Oct 05 '20 14:10 marktaylor46

Wow, what was the point of adding this to begin with then? What a massive reversal.

simmonsr avatar Oct 05 '20 14:10 simmonsr

Because static caching would be good on particles that just use "particle" datasource as if you've change the particle content then the cache would be refreshed anyway. The problem comes if you are sourcing data external to the particle itself (i.e. the CMS)

marktaylor46 avatar Oct 05 '20 14:10 marktaylor46

Updated all RocketTheme CMS source particles that use caching type: static to

  caching:
    type: config_matches
    values:
      source: 'particle'

So it only caches when the source being used is particle.

simmonsr avatar Oct 05 '20 20:10 simmonsr

Update will be available during next themes update.

simmonsr avatar Oct 05 '20 20:10 simmonsr