Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
Before I say this is a bug, I am going to explore it as a support request.
I had "skip hash" selected on the node import settings form.
I noticed that my cache_form was insanely huge (110M) with just one person testing/developing.
We noticed that most of the forms were from a feeds import that we had.
I wonder if there is a way to exclude certain forms from cache. Specifically I would like to exclude my feeds form, or the node the importer is attached to, from being cached in cache_form.
Comments
Comment #1
MegaChriz CreditAttribution: MegaChriz commentedThe form cache works differently compared to Drupal's other caches. Drupal uses the form cache to validate if the posted values belong to fields that were in the form. Therefore, I don't think that it's possible to exclude forms from the form cache. Form cache getting huge is also a general Drupal problem. If you search for "drupal form cache huge" you will find a lot of reports about this issue. Some people reported that their form cache even grew gigabytes big.
Feeds does have a lot of forms on the importer configuration. Each "section" (e.g., "Basic settings", "Fetcher settings", "Change processor", etc.) is it's own form. Also, up until the 7.x-2.0-alpha8 version, Feeds wasn't efficient on the importer configuration: on each page load it checked for fetcher, parser and processor if they provided settings by loading it's specific settings form, meaning that three extra forms were loaded and cached. This inefficiency was fixed in #2307379: Add FeedsConfigurable::hasConfigForm().
Comment #2
MegaChriz CreditAttribution: MegaChriz commentedOops, forget to mention a good workaround.
What I did for one site where form cache was huge, was clean up old entries in this cache more often. By default, Drupal keeps entries in the form cache for at least 6 hours, and that's a hard-coded value, see
form_set_cache()
from includes/form.inc:I changed this to clear up entries after 1 hour by implementing
hook_cron()
in a custom module:You could of course change the logic a bit to only clear Feeds related forms.
Comment #3
SocialNicheGuru CreditAttribution: SocialNicheGuru commentedhow would I clear just the cache_form entries associated with feeds?
In cache I only see cache_form and cache_form_state.
Comment #4
SocialNicheGuru CreditAttribution: SocialNicheGuru commentedThis might do the trick:
https://www.drupal.org/node/795044#comment-3516124
Comment #5
vakulrai CreditAttribution: vakulrai as a volunteer and at gai Technologies Pvt Ltd for gai Technologies Pvt Ltd commentedThe OptimizeDB module might do the trick with following functionalities:-
1)Ability to clean cache_form .
2)Optimize DB tables.
Please follow the link:-
https://www.drupal.org/project/optimizedb