[wp-trac] [WordPress Trac] #31245: Replace alloptions with a key cache

WordPress Trac noreply at wordpress.org
Mon Feb 9 05:57:41 UTC 2015


#31245: Replace alloptions with a key cache
-------------------------------------+--------------------------
 Reporter:  rmccue                   |       Owner:  rmccue
     Type:  enhancement              |      Status:  assigned
 Priority:  normal                   |   Milestone:  4.2
Component:  Options, Meta APIs       |     Version:
 Severity:  normal                   |  Resolution:
 Keywords:  has-patch needs-testing  |     Focuses:  performance
-------------------------------------+--------------------------

Comment (by rmccue):

 I'd just like to note down the formats out there in the wild already.

 Note: in the below, `group` is a normal group name, like `options`, `id`
 is a cache key like `alloptions`, and `key` is an automatically generated
 key like `$salt:$db_prefix:$group:$id`

 === Original memcached ===

 Input:
 {{{
 get_multi( array( $group => array( $id, $id2, ... ), $group2 => array(
 $id3 ), ... ) )
 }}}

 Output:
 {{{
 array( $key => $value, $key2 => $value, $key3 => $value )
 }}}

 Available as: `$wp_object_cache->get_multi`

 === PECL Memcache ===

 Input:
 {{{
 get_multi( array( $id, $id2, $id3, ... ), array( $group, $group, $group2,
 ... ) )
 }}}

 Output:
 {{{
 array( $key => $value, $key2 => $value, $key3 => value )
 }}}

 Available as: `$wp_object_cache->getMulti` and `wp_cache_get_multi`

 === Memcached Redux ===

 Input:
 {{{
 get_multi( array( $id, $group ), array( $id2, $group ), array( $id3,
 $group2 ) )
 }}}

 Output:
 {{{
 array( $value, $value, $value )
 }}}

 (Note that the output order is identical to the input order, however it is
 a
 list, not an associative array.)

 Available as `$wp_object_cache->get_multi` and `wp_cache_get_multi`

 ----

 Anything that uses `$key` is pretty useless for keying, as they're
 internal keys
 and implementation changes depending on the cache. You'd also need to pull
 them
 back out again. You can almost treat them as ordered to use it, but as far
 as I
 can see, they don't guarantee this.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/31245#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list