[wp-trac] [WordPress Trac] #16287: get_option() - store retrieved option in a global array?

WordPress Trac wp-trac at lists.automattic.com
Tue Jan 18 16:20:16 UTC 2011


#16287: get_option() - store retrieved option in a global array?
----------------------------------+----------------------
 Reporter:  digitalnature         |       Owner:
     Type:  enhancement           |      Status:  closed
 Priority:  normal                |   Milestone:
Component:  Database              |     Version:  3.1
 Severity:  normal                |  Resolution:  invalid
 Keywords:  get_option, database  |
----------------------------------+----------------------

Comment (by digitalnature):

 thank you very much for clarifying that, but then we're back on the
 purpose of the ticket :)
 because the built in cache doesn't seem to work very good for the current
 page load.

 test this yourself with get_option():
 - load a page, and check the db query count with (I used get_num_queries()
 in footer)
 - activate a few plugins, and add a few widgets
 - in get_option(), add:
 {{{
 global $__wp_settings;
 if(isset($__wp_settings[$option])) return $__wp_settings[$option];
 }}}
 - and at the end, before returning:
 {{{
 $__wp_settings[$option] = $value;
 }}}
 - load the same page, and check db query count again

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/16287#comment:10>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list