Make WordPress Core

Opened 19 years ago

Closed 19 years ago

Last modified 17 years ago

#1499 closed defect (bug) (fixed)

add_option shouldn't always check db for pre-existing option

Reported by: westi's profile westi Owned by: markjaquith's profile markjaquith
Milestone: Priority: normal
Severity: minor Version: 1.5.2
Component: Optimization Keywords: bg|has-patch bg|commit
Focuses: Cc:

Description

Currently some plugins do the following everytime they are run:

add_option('my_opt',...);
get_option('my_opt',...);

When these options are defined with autoload as yes wordpress automatically loads them at startup - the add_option code should check the cache to see if the option already exists before checking the db to save on queries.

Patch attached to do this cache checking.

Attachments (2)

functions.php.diff (674 bytes) - added by westi 19 years ago.
Patch to functions.php to improve add_option
functions.php.2.diff (564 bytes) - added by markjaquith 19 years ago.
Patch for WP 1.6 SVN

Download all attachments as: .zip

Change History (9)

@westi
19 years ago

Patch to functions.php to improve add_option

#1 @westi
19 years ago

  • Keywords bg|has-patch bg|2nd-opinion added

#2 @westi
19 years ago

  • Milestone set to 1.5.2

#3 @matt
19 years ago

  • Milestone changed from 1.5.2 to 1.6

#4 @davidhouse
19 years ago

Looks good. Caching is good :)

@markjaquith
19 years ago

Patch for WP 1.6 SVN

#5 @markjaquith
19 years ago

  • Keywords bg|commit added; bg|2nd-opinion removed
  • Owner changed from anonymous to markjaquith
  • Severity changed from trivial to minor
  • Status changed from new to assigned
  • Version changed from 1.5.1.2 to 1.5.2

Old patch wasn't working. Recreated it. Let's get this in the core already! It creates a lot of extra queries!

#6 @ryan
19 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [2856]) Check the option cache before querying. Props westi. fixes #1499

#7 @(none)
17 years ago

  • Milestone 2.0 deleted

Milestone 2.0 deleted

Note: See TracTickets for help on using tickets.