Project

General

Profile

Actions

Feature #56173

closed

Clear Cache Task

Added by Philipp Wrann about 10 years ago. Updated over 6 years ago.

Status:
Rejected
Priority:
Should have
Assignee:
Category:
scheduler
Target version:
Start date:
2014-02-21
Due date:
% Done:

0%

Estimated time:
3.00 h
PHP Version:
Tags:
Complexity:
easy
Sprint Focus:

Description

Please integrate a clear cache task in typo3, configureable by cachegroups and or tags.
Maybe some kind of CachingFrameworkCommandController that provides several cache-specific tasks to run.

This would be of great help for deployment, as you could simply run that task after deploying a new version.

There are some extensions that handled this but neither of them is working for me (6.2) and i think such a feature should be available in all installations by default.

Actions #1

Updated by Philipp Gampe about 10 years ago

  • Status changed from New to Needs Feedback

I do not think this should be a scheduler task. You do not need to do this regularly.

I think it would be better if we could clear cache from command line.


./typo3/cli_dispatch.phpsh core clear-cache-group system # clear group (like in top bar)
./typo3/cli_dispatch.phpsh core clear-cache-tag page_243 # clear tag in all caches
./typo3/cli_dispatch.phpsh core clear-cache fluid_template # clear single cache
./typo3/cli_dispatch.phpsh core cleanup-cache cache-rootline # remove expired entries
./typo3/cli_dispatch.phpsh core cleanup-cache-group frontend # cleanup all frontend caches

Effectively this would expose the caching framework to the shell.

Actions #2

Updated by Philipp Wrann about 10 years ago

Yes exactly. That is what i actually wanted to request.

Actions #3

Updated by Philipp Wrann about 10 years ago

Flushing of all caches somtimes takes a few seconds, maybe some kind of maintainance mechanism would be fine.

I would suggest touching a file called maintenance.tmp in typo3conf
when the file is present send 503 header and redirect to a configured static file.
that file is located in the rootdirectory and has a refresh of 15 seconds.

could be dealt with via htaccess or bootstrap process and would make deploying more robust.

When flushing is done unlink maintenance.tmp file and everything is fine again.

Actions #4

Updated by Philipp Wrann about 10 years ago

What about some feedback on this?

maintenance while flushing caches

when calling ./typo3/cli_dispatch.phpsh core clear-cache-group system true

the second parameter causes the maintenance to take place
this will automatically be called when flushing all caches from installtool

step 1: create a checkfile in typo3temp called maintenance
step 2: sleep for a few seconds, so apache can handle open requests
step 3: flush caches
step 4: rm the maintenance file

in the htaccess there is a check for the maintenance file
if it exists redirect to maintenance.php file in root directory

that file is pretty static, just sending some headers, loading LocalConfiguration for some settings and includes a template, that is configured to a static core file by default

We will be back soon, blabla

additionally a meta-refresh should be present to refresh the page after a few seconds

######

Background:
i configured most caches to apc, so when flushing some caches and someone requests the page in the meantime some caches are written to the a file in typo3temp/Cache, for some reason - if that happens - the autoload mechanism is broken and i get many many exceptions thrown for not-found files, typically t4lib_div and so on used in older extensions.
With the behaviour above you could prevent from that.

Actions #5

Updated by Alexander Opitz about 10 years ago

  • Status changed from Needs Feedback to New
Actions #6

Updated by Philipp Wrann about 10 years ago

One more thing i would consider:
When a maintenance file exists or some other flag is set dont execute any tasks

got a weird problem in my system when deploying while some heavy import task is executing, you could prevent that if a maintenance mode would lock tasks

So lets recap:
1) create command to enable maintenance-file, the tool returns only if no tasks are running and the file is created, if some tasks are about to be executed (without error) the script waits until no tasks are active
1) enable maintenance mode (a maintenance.php is called instead of index.php - via htaccess i would recommend) when the file maintenance.enable exists in document root
2) maintenance mode prevents from executing tasks
3) create command to clear caches
4) create command to end maintenance

Some deploy process could then be:
1) connect
2) create maintenance
3) build
4) flush caches
5) end maintenance

Actions #7

Updated by Benni Mack almost 9 years ago

  • Status changed from New to Accepted
  • Assignee set to Benni Mack
  • Target version changed from 6.2.0 to 7 LTS

We will get this going. thanks for the report!

Actions #8

Updated by Benni Mack over 8 years ago

  • Target version changed from 7 LTS to 8 LTS
Actions #9

Updated by Riccardo De Contardi about 7 years ago

  • Target version changed from 8 LTS to 9.0
Actions #10

Updated by Benni Mack over 6 years ago

  • Status changed from Accepted to Rejected

This will be part of TYPO3 Console, as it's the swiss army knife for TYPO3 as companion.

Actions

Also available in: Atom PDF