2

In Drupal 6, I'm writing a custom module that generates several pages (as a Drupal newbie). Mainly public form pages for soliciting donations - users fill out their info (amount, frequency, etc.) and we bundle it and send the user to payment processor.

On the admin side, this module gathers several items so that the form can be generated. Dollar amounts, benefit levels for donors, summary info, etc. So the vast majority are small text fields, with just a few words or a few integers. Nothing from the user submission is stored in Drupal.

What I've been doing up to this point is storing each item with variable_set and retrieving it on the public form pages with variable_get. This works fine, but I'm starting to worry that I might be getting myself into a performance problem.

Currently I see that there are 36 rows in the variable table that come from this module. I don't know if that's bad, but I'm also not finished. As there are ~four "pages" associated with this module and I've only done one of them, there could conceivably be ~100 rows.

This leaves a few questions in my mind.

  • Am I at the point where I need to make a custom table for my module?
  • Will these rows all be cached (I'm aware of cache_set but I'm not sure how that relates to variable_set if it does)?
  • If they are cached (either automatically or because I use cache_set for them) will that solve any potential issues?
  • If I should use cache_set what is the best method for caching a bunch of tiny things? Should I try to bundle them and cache them all at once after the admin form is submitted?
  • The same for cache_get - what is the best way to retrieve these kind of things?

I'm asking this because I'm seeing a lot of places where variable_set is discouraged once there gets to be a lot of data, but I'm not sure if I'm at that point or not.

Thanks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.