views:

13

answers:

1

I'm working on a new Joomla! module where I need to store a read-only data of about 40 key/value pairs with a keyword and corresponding URL link. There are several options but I'm not sure which one would be convenient for the programmer and fast-loading for the user. Or maybe because the data amount is so small it doesn't really matter what method is used.

I could hardcode the values into an array as part of the module code. Not convenient to update but it does load fast.

I could store the data in an flat file or XML file. This would require additional code to implement and would be convenient for updating the list, but doesn't load as fast as being hardcoded.

I could create a table in the database. The Joomla API makes this is a no brainer to use but I'm not sure how much overhead there would with everything else being loaded from the database.

How do I logically evaluate which one works best without trying out each of the options?

+1  A: 

Your two opposing concerns are

  1. frequency with which the programmer updates these key value pairs
  2. frequency with which the application queries them

If they're updated more than occasionally, your best bet is to have them in the database and then cache the data at some desirable interval if you're worried about it.

LesterDove
This is read only data for the module and isn't meant to be updated by the user. I would use the database if the user could modify the data. Point one should be how convenient is it to the programmer to update the data. If module is used on home page, then data is queried all the time.
C.D. Reimer
Sorry, that was an unfortunate typo -- I did mean to say 'programmer' for #1 (edited.) For #2, I do think that the caching object will help. Hope you find your answer.
LesterDove