[wp-trac] [WordPress Trac] #40064: Deprecate `get_blog_details()`

WordPress Trac noreply at wordpress.org
Thu Mar 9 23:06:08 UTC 2017


#40064: Deprecate `get_blog_details()`
--------------------------------+------------------------
 Reporter:  flixos90            |       Owner:
     Type:  enhancement         |      Status:  new
 Priority:  normal              |   Milestone:  4.8
Component:  Networks and Sites  |     Version:
 Severity:  normal              |  Resolution:
 Keywords:                      |     Focuses:  multisite
--------------------------------+------------------------

Comment (by spacedmonkey):

 There are a number of reason to refactor this function. Firstly, the code
 is extremely hard to read. Readability is important in maintain of code
 and this is really hard. The second and more important is how this
 function caching is horrible. This function generates 3 caches. Keys are
 listed below.

 {{{#!php
         wp_cache_delete( $blog_id , 'blog-details' );
         wp_cache_delete( $blog_id . 'short' , 'blog-details' );
         wp_cache_delete(  $domain_path_key, 'blog-lookup' );
 }}}

 All of these caches store the whole wp_site object in the object store.
 This is wasteful and resource intensive. These caches should store the
 object id and not the object itself. if we don't refactor, this bad
 caching will remain and possibly make problems down the line. It also
 means that in the clean_blog_cache function will be have to keep the
 invalidation (cache deletes) forever. So will have to do these deletes
 even through those cache will more than likely never be hit. Deletin empty
 caches is also wasteful.

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


More information about the wp-trac mailing list