[TYPO3-core] RFC: Feature #15306: [Caching framework] Add scheduler task to execute garbage collection
Christian Kuhn
lolli at schwarzbu.ch
Fri Oct 8 20:28:50 CEST 2010
On 07/30/2010 04:17 PM, Christian Kuhn wrote:
> Problem:
> Some caching framework cache backends (like the default database
> backend) do not delete expired cache data automatically. Therefore they
> implement the collectGarbage() method. This method is currently never
> called by core.
>
> Solution:
> Implement a caching framework garbage collection task for the scheduler,
> enabling admins to execute the garbage colletion when the system is
> mostly idle. An additional field in the task lets an admin choose which
> backend types should be cleaned up. The task then finds all configured
> caches with this backend type and calls collectGarbage().
Attached v2. Please review.
This task basically goes through all configured caches in
typo3_conf_vars, checks if the configured backend is one of the
to-be-cleaned backends, instantiates this cache object (if not done
before) and calls the garbage collection. So, it's important to have all
cache definitions in typo3_conf_vars and that's why i created all the
fuss about the frontend definitions.
Funnily the caching framework _can_ be used by extensions for own caches
without forcing the core caches to run through the caching framework
(yuck!). This is what for instance extbase does with the reflection
cache. All an extension needs to do is to make sure that the factory and
manager objects are present. This can be done my asking
t3lib_cache::isCachingFrameworkInitialized() and initialize it on false.
This must be done in ext_localconf. If
$TYPO3_CONF_VARS['SYS']['useCachingFramework'] is TRUE, this is done by
the core already.
So, here are the different scenarios and how this task will react:
a) useCachingFramework = TRUE, core caches and additional caches
defined: All caches will be garbage collected.
b) useCachingFramework = FALSE, no extensions with defined cf caches:
Nothing will be done.
c) useCachingFramework = FALSE, some extension defines cf caches with
proper initialization: Both extension caches _and_ core caches will be
garbage collected, even if the core caches are not used. This is because
the core caches can not be differentiated from other caches and I didn't
want to hardcode some arbitrary exception for this case in the task.
Shouldn't harm anyway.
Regards
Christian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 15306_02.diff
Type: text/x-patch
Size: 18506 bytes
Desc: not available
URL: <http://lists.typo3.org/pipermail/typo3-team-core/attachments/20101008/49819429/attachment-0001.bin>
More information about the TYPO3-team-core
mailing list