[wp-trac] [WordPress Trac] #43506: Ensure a network's `notoptions` cache is an array to reduce lookup overhead

WordPress Trac noreply at wordpress.org
Thu Mar 8 22:29:13 UTC 2018


#43506: Ensure a network's `notoptions` cache is an array to reduce lookup overhead
--------------------------------+------------------------------------------
 Reporter:  flixos90            |      Owner:
     Type:  defect (bug)        |     Status:  new
 Priority:  normal              |  Milestone:  Awaiting Review
Component:  Options, Meta APIs  |    Version:
 Severity:  normal              |   Keywords:  needs-patch needs-unit-tests
  Focuses:  multisite           |
--------------------------------+------------------------------------------
 In every call to `get_network_option()` the global
 `{$network_id}:notoptions` cache is requested. However the function only
 sets a value for that cache if both the individual network option's cache
 lookup and its database lookup failed failed, which in most cases will
 (and should) not be the case.

 This isn't a significant problem, but when using an external object cache,
 this causes that cache to be called every time `get_network_option()` is
 called. If instead `get_network_option()` ensured an empty array is set on
 a cache miss, that would only happen once per request, as the local cache
 would afterwards have that value stored.

 It's admittedly a very minor performance improvement, but I think it's
 worth it, as there should be no downside to it.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/43506>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list