LiTWol @ Oleg Terenchuk

  • Contact
  • About me

User login

What is OpenID?
To prevent automated spam submissions leave this field empty.
  • Log in using OpenID
  • Cancel OpenID login
  • Request new password

litwol's tweets

  • Life is one large balancing act. In fact, we all work for a large circus. The funny thing is most just don't get paid for it. — 47 weeks 1 day ago
  •  
  • 1 of 9
  • ››
more
Home

Pre-generating drupal forms

Submitted by litwol on Mon, 07/20/2009 - 23:23

Theoretically we can pre-genrate drupal form output and cache it which then will be served instead of regenrating form html on every form view.

Few issues:
1) CSRF tokens make form caching useless.
2) Form action in HTML makes cross-page caching useless because on each page form action is set to be that page's URL.

Possible solutions:
1) Cache based on session_id, which is what the form token is based on
2) We can perform string replacement on the cached form output to correct form action.
3) Do NOT inject CSRF protection into search form. Search form redirects to a GET page therefore performing CSRF check on it is a waste of resource.

Most user facing forms are fetched using drupal_get_form(), more so forms are rendered using drupal_render_form().

To make the above work we need to change drupal_render_form to store rendered HTML in cache and change drupal_get_form() to first attempt to load form HTML from cache and serve that if cache exist.

  • 1906 reads

Recent posts

  • Developing PHP in VIM - VIM IDE for PHP
  • Creating custom fields using Drupal 7 field api
  • Creating 3d cube movieClip using Sprites and animating rotation through ActionsScript 3.0
  • Adding sprite from inside an external class onto stage and animating it using arrow key movement.
  • Playing with flash keyboard click events
  • Script to benchmark API execution time.
  • Very good dvcs guide
  • High throughput web architecture with drupal - *For authenticated users*
  • About me - Oleg Terenchuk
  • Note to self
  • Pre-generating drupal forms
  • Change memcached admin stats page
  • The cult of done

LiTWoL © Oleg Terenchuk - Hosted on Linode.com 360

I love Smashing Magazine!
Fervens Drupal theme by Leow Kah Thong. Designed by Design Disease and brought to you by Smashing Magazine.