0

enter image description hereThere is an option to warmup cache in System->Maintanance->Warmup cache . I have to warmup cache weekly in my contao site. So that I am thinking to write a scheduler task . I know there is an option for implementing scheduler task

$GLOBALS['TL_CRON']

What will be the risks for implementing this ? Any security risk behind this cache warmup in scheduler ?

In brief :- I need a scheduler for page cache warmup.

  • Disabled pages should not be included
    • Hidden pages should also be warmed up
Aswathy S
  • 729
  • 1
  • 12
  • 41

2 Answers2

1

I am assuming you are referring to a Contao 3 installation and by cache you mean the internal cache, which you can purge in the maintenance section of the back end and can then rebuild.

For this you could use the \Contao\Automator class for which there also exists a command line interface. To purge and rebuild the internal cache you could use the following command:

$ php system/bin/automator generateInternalCache

Replace php with the paht to an appropriate PHP CLI if necessary (preferably with the PHP version that your Contao installation uses).

Update:

For Contao 4 (Managed Edition), which is a Symfony based application, you can use the following commands:

$ php vendor/bin/contao-console cache:clear --no-warmup
$ php vendor/bin/contao-console cache:warmup
fritzmg
  • 2,494
  • 3
  • 21
  • 51
  • I am using contao 4.6.14 – Aswathy S Mar 14 '19 at 08:28
  • 1
    Please provide all the necessary information in your original post the next time. – fritzmg Mar 14 '19 at 08:51
  • it is necessery to purge search cache, page cache , search idex before cache warmup ? – Aswathy S Mar 14 '19 at 09:06
  • 1
    No, those caches have nothing to do with the application cache. Why do you need to warmup your application cache regularly anyway? – fritzmg Mar 14 '19 at 09:23
  • Actually my client need to clear cache weekly . Anyway the cache:warmup only clear the application cache ? I also need to clear search cache, page cache , search idex . Any alternative method available to attain my requirement ? – Aswathy S Mar 14 '19 at 10:57
  • Please provide all necessary information in your original post. It seem you are not talking about the application cache at all. Please also provide information as to why you need this in the first place. – fritzmg Mar 14 '19 at 12:24
1

There is no way to do what you want to do via a command or cron entry. Things like search reindexing or the frontend page cache warmup of the extension you are using only work via JavaScript AJAX requests - thus they need a client to work. Contao does not yet have the ability to use something like a server side request queue for page cache warming and search indexing.

fritzmg
  • 2,494
  • 3
  • 21
  • 51