After enabling Authcache Form sub-module, the forms cache appropriately, but the cache_form table never clears (even on manual flush).

This bloats the table to +1,000,000 rows very quickly and makes the database unmanageable.

Comments

firewaller created an issue. See original summary.

Marko B’s picture

This is probably not connected to auth cache. Its common drupal problem

https://www.drupal.org/node/1506196
https://www.drupal.org/node/2057073
....

There is even a module for that
https://www.drupal.org/project/optimizedb

znerol’s picture

Thanks for the report. Could you please dig a bit in your data and try to figure out if there is a particular form which is responsible for this behavior? The following script selects the 1000 most recent entries, extracts the form ids, and sums up how many times that particular form has been stored in the sample.

define('DRUPAL_ROOT', getcwd());

include_once DRUPAL_ROOT . '/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);

$q = db_select('cache_form')
  ->condition('cid', '%form_state%', 'NOT LIKE')
  ->fields('cache_form', array('cid', 'data'))
  ->orderBy('created', 'DESC')
  ->range(0, 1000);

$counts = array();
foreach ($q->execute()->fetchAllKeyed() as $cid => $data) {
  $form = unserialize($data);
  $counts[$form['#form_id']]++;
}
arsort($counts);
var_dump($counts);
znerol’s picture

Status: Active » Postponed (maintainer needs more info)
znerol’s picture

Status: Postponed (maintainer needs more info) » Closed (outdated)
Marko B’s picture

Nice snippet :)