Beta phase evaluation
Issue category | Bug because the FormCache code hardcodes a magic value to govern how long a form can cache an object. |
---|---|
Issue priority | Minor because no functionality has been changed. The "fix" here provides programmers a better way to override the magic value being set. This improves DX by not requiring that developers re-implement large sections of code and instead just override the object's constant. |
Unfrozen changes | Unfrozen because it only changes the storage location of the magic value being used to govern how long a form can be cached. |
Prioritized changes | This is not a prioritized change for the beta phase. |
Disruption | This is not a disruptive change. Also, because we're changing the internal logic of an object, and not an external API, this change could be made during the 8.1.x developer time period. It's just a troublesome reality to live with from a DX perspective. |
Original description
Currently the form cache has a lifetime of 6 hours by default.
I'd like to see the possibility to define a cache lifetime by using relative date formats like in php's strtotime.
Further it would be nice to be able to set the form cache expiration per form - e.g. with $form_state['cache_expire']
(Another solution could be to store this information straight into $form_state['cache']
)
The goal I've in mind is to be able to get the lifetime of the page cache and the form cache in sync (The page cache is a whole different story ;) )
The scenario I think of is a website where all the pages, including the forms on it, are cacheable until tomorrow (midnight). But if the form cache is cleared before the page cache things break e.g. the ajax magic.
The attached patch contains the changes needed to introduce a custom form lifetime. The setting can be found in admin/config/development/performance
.