[title sub="Written by Chris Graham (ocProducts)"]Composr Tutorial: Cleanup tools[/title]

{!cleanup:DOC_CLEANUP_TOOLS}

The tools are divided into "De-cachers" and "Optimisers" (which don't all strictly involve optimising, some are for general other kinds of maintenance task).

[contents]decimal,lower-alpha[/contents]

[title="2"]Caches / De-cachers[/title]

[surround]
[media width="150" description="Disabling caches" float="right"]data_custom/images/docs/tut_cleanup/cleanup_2.png[/media]
For performance reasons, Composr defines a number of caches. During normal operation of Composr, these caches should be unnoticeable; if things are being edited from outside Composr theoretically Composr will automatically pick up on it, but you may sometimes need to force a cache flush.

On a default install all recommended caches are enabled.

Some kinds of cache may be turned off in the configuration, but leaving them on gives vastly improved performance.

If you can identify a situation where you need to rebuild or empty a cache that should not exist, please report it as a bug.

[title="3"]Self-learning cache[/title]

The self-learning cache is quite a sophisticated cache mechanism to speed up Composr. It learns what resources are used by a page, and then bulk-loads them in the future.

The self-learning cache is most relevant when it comes to language strings. To avoid having to load up all the language files a page might use (language files are relatively monolithic, so inefficient to load), it will remember what strings are used by a page. Pages may use different strings when executed in different contexts, so the cache will always fall-back to loading the full language files if it has to, with those strings then also being added to the cache for the future. However, what if a page is referencing a string that does not exist? The self-learning cache would always be loading the full language files to try and hunt for it. This is why the cache also learns [i]what strings are used by a page but do not actually exist even in the full language files[/i]. A ramification of this is that if you are developing and add the strings later, you will need to clear out the self-learning cache for Composr to be able to pick up on the new strings. Further, if you referenced language strings at any point while forgetting to first do a language file include, the self-learning cache will just figure these strings don't exist anywhere, even if you add the include later.
[/surround]

[title="2"]Optimisers (advanced)[/title]

[surround]
[media width="150" description="The cleanup tools screen" float="right"]data_custom/images/docs/tut_cleanup/cleanup_1.png[/media]
There are a number of optimisers:
 - [b]Correct MySQL schema issues[/b] -- this is intended for programmers-only, you are very unlikely to need it.
 - [b]Optimise/fix database tables[/b] -- this will try and fix some database tables and works with MySQL-only. If the database has become very corrupt, you may need to use a tool such as phpMyAdmin to repair a database from outside Composr.
 - [b]Broken URLs[/b] -- this will look for broken URLs.
 - [b]Regenerate image thumbnails[/b] -- this will regenerate all thumbnails (slow and probably not useful).
 - [b]Find orphaned uploads[/b] -- find on-disk uploads that seem to no longer be referenced.
 - [b]Delete page access statistics[/b] -- remove old page statistics to reduce database usage.

Frankly most of these optimisers are not useful. We provide them for very rare situations, or for helping programmers manage complicated operations.
[/surround]

[concepts
 1_key="Cache"                 1_value="A data store that contains precalculated results such that those results do not need to be calculated more than once; caches are designed to increase efficiency"
]Concepts[/concepts]

[title="2"]See also[/title]

 - [page="_SEARCH:tut_framework"]The Composr programming framework[/page]

{$SET,tutorial_tags,core_cleanup_tools,Maintenance,regular}{$SET,tutorial_add_date,Aug 2008}{$SET,tutorial_summary,Been editing files manually, and need to force Composr to "empty its caches"? We show you how.}[block]main_tutorial_rating[/block]
