Last updated 4 March 2015. Created on 7 October 2009.
Edited by Valentine94, LeeHunter, NancyDru. Log in to edit this page.

Cleaner is a contributed module that allows you to set a schedule for clearing caches, watchdog, and old sessions.

There are functions in Drupal which will cause "expired" entries in some cache tables to be deleted. This is vastly improved in Drupal 6. "Minimum_cache_lifetime" is a partial solution, but still not totally complete.

There are still times and/or cache tables that don't get cleared in any of those scenarios. Many sites will not be impacted by this, but a few will (just search on and you will see many posts from people having problems).

Consider an actual experience. I maintain a site that is based on Panels, Nodequeue, and Views. In this set up, the cache entries can get very large after some time. MySql has a parameter ("max_allowed_packet") that limits how much data can be read in. If this limit is exceeded, MySql does not throw an error, rather it just provides what data it could read. With no error indication, the site just goes merrily on its way with what was given to it. In this case both the panel definition and nodequeue contents went haywire. Clearing the cache resolved the issue for the moment.

Then I remembered this module that I had written and dismissed as "silly" after getting it working. Now, I will admit that the hooks provided here probably are "silly" but I had included them originally, so they are still there. I don't know why anyone would use them, but if you want, knock yourself out.


Standard module installation applies.

Uninstall function:


The settings may be found at Administer » Site configuration » Cleaner.

Run interval
This is how often the options below will occur. The actions will occur on the next Cron run after this interval expires. "Every time" means on every Cron run.
Clear cache
This will cause the cache tables to be emptied. A list of all know cache tables will be extracted from the database.
Empty Watchdog
This will cause the log (watchdog) table to be emptied. There is a standard setting for controlling Watchdog contents. This is more useful for test sites.
Clean up Sessions table
The sessions table can quickly become full with old, abandoned sessions. This will delete all sessions older than interval (as set by your site administrator). There are currently count such sessions.
Clean up CSS files
The CSS directory can become full with stale and outdated cache files. This will delete all CSS cache files but the latest.
Clean up JS files
The JS directory can become full with stale and outdated cache files. This will delete all JS cache files but the latest.


There are no new permissions for this module. 'Administer site configuration' is required to run it.

Menu Entries / URIs

There is one menu entry for "Cleaner" it is for the settings page


There are no blocks for this module.

Styling and Themes

Not applicable.

Looking for support? Visit the forums, or join #drupal-support in IRC.