gantry / gantry5

:rocket: Next Generation Template / Theme Framework
http://gantry.org
1.03k stars 203 forks source link

News Slider particle or particle-module does not clean cache #2688

Open danjde opened 4 years ago

danjde commented 4 years ago

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 commented 4 years ago

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

ghost commented 4 years ago

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

danjde commented 4 years ago

...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...

ghost commented 4 years ago

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.

danjde commented 4 years ago

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

N8Solutions commented 4 years ago

@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

ghost commented 4 years ago

@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.

danjde commented 4 years ago

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

N8Solutions commented 4 years ago

@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.

danjde commented 4 years ago

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 commented 4 years ago

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

Thanks again!

danjde commented 4 years ago

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

mahagr commented 4 years ago

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 commented 4 years ago

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

ghost commented 4 years ago

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

danjde commented 4 years ago

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

I too, none changes.

mahagr commented 4 years ago

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 commented 4 years ago

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

ghost commented 4 years ago

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.

simmonsr commented 4 years ago

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

configuration:
  caching:
    type: static
ghost commented 4 years ago

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

simmonsr commented 4 years ago

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

ghost commented 4 years ago

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)

simmonsr commented 4 years ago

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 commented 4 years ago

Update will be available during next themes update.