[wp-trac] [WordPress Trac] #32452: Cache optimizations

WordPress Trac noreply at wordpress.org
Wed May 20 23:54:52 UTC 2015


#32452: Cache optimizations
-----------------------------+-----------------------------
 Reporter:  Relevad          |      Owner:
     Type:  feature request  |     Status:  new
 Priority:  normal           |  Milestone:  Awaiting Review
Component:  Cache API        |    Version:  4.1
 Severity:  normal           |   Keywords:
  Focuses:                   |
-----------------------------+-----------------------------
 Hi,

 I've recently been making some custom modifications to wordpress core that
 reduce the resource load on our object-caching system.
 I cannot see any drawbacks to these modifications, but I have to defer to
 the wp-core development team on this one and therefore assume I've missed
 something.
 I want to know if there is anything I overlooked while making these
 modifications.
 If there are no drawbacks, then perhaps the changes could be rolled into
 wp-core officially (and then I won't have svn showing files as modified
 all the time)

 Explanation: (broken down into sections)
 1) I noticed a huge amount of 'extra' queries to the object-cache.
 Many of them originating from calls to wp_load_alloptions()
 I believe with my modifications wp_load_alloptions() only needs to be
 called in one place instead of many, and that is within the definition of
 the object-cache itself.

 2) I've also reduced redundant queries by changing the assumption that a
 key doesn't exist to a key does exist. Check the cache for the key first
 instead of checking the 'negative' cache for the key first.

 3) Some minor fixes in options.php
 ---- removed untrailingslashit on line#109 // function does not yet exist
 if called from within functions.php
 ---- added ! $result == 0 line#288 // if a database update effects zero
 rows the cache should still be updated
 ---- pre-emptively negatively cache (into notoptions) the just deleted
 option  line#477


 All file changes (from svn diff) available at this link:
 http://pastebin.com/5vPGCCt7

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


More information about the wp-trac mailing list