[wp-hackers] How do you store multiple plugin options
Potkanski, Jason
jpotkanski at tribune.com
Wed Mar 24 20:24:55 UTC 2010
On 3/24/10 2:28 PM, "Peter van der Does" <peter at avirtualhome.com> wrote:
On Wed, 24 Mar 2010 12:56:42 -0500
"Potkanski, Jason" <jpotkanski at tribune.com> wrote:
>
>>
>> Correct practice should be to avoid serialized arrays where possible
>> and use proper prefixing in blog options to avoid collisions with
>> other plugins.
>>
>
> Ils understand what you are saying, so what is your solution to this
> problem?
> Storing every option separately in the WordPress options table creates
> an overhead on MySQL calls. Reading the database 10 times for 10
> options would be a lot slower as calling the database 1 times and
> unserializing the option.
wp_load_options() bulk loads all these options with one DB call. Most of the time the get_option is going to hit the memory cache.
> I can think of a solution that would take out the serialization but it means
> rewriting the
> get/update/set_option functions and adding a table.
Not sure if you need the separate table.
I would propose the a new define "WP_NORMALIZE_DB" or some such which would use different version of the get/update/set_option functions that wouldn't serialize the data. It would probably require an addition to the schema options table of a 'child' column so that it relates to a master option.
--
Jason Potkanski
Tribune Technology
More information about the wp-hackers
mailing list