[wp-trac] [WordPress Trac] #21434: Don't obliterate the object cache in switch_to_blog()
WordPress Trac
wp-trac at lists.automattic.com
Sat Sep 29 19:18:38 UTC 2012
#21434: Don't obliterate the object cache in switch_to_blog()
-------------------------+---------------------
Reporter: ryan | Owner: ryan
Type: enhancement | Status: closed
Priority: normal | Milestone: 3.5
Component: Cache | Version: 3.4.1
Severity: normal | Resolution: fixed
Keywords: |
-------------------------+---------------------
Comment (by convissor):
The new, efficient code for switching between blogs is an excellent
improvement. Thanks.
Can you please elaborate on the reasoning behind deprecating
{{{wp_cache_reset()}}} / {{{WP_Object_Cache::reset()}}} and why the
deprecation message instructs people to use
{{{wp_cache_switch_to_blog()}}} / {{{switch_to_blog()}}}? The
{{{reset()}}} and {{{switch_to_blog()}}} methods serve two separate
purposes. (Though some people may have used them in conjunction.)
May I suggest the deprecation message direct people to
{{{wp_cache_flush()}}} / {{{flush()}}} instead or have the replacement
parameter mention both the flush and switch methods (eg "{{{flush() or
switch_to_blog()}}}").
The reason I bring this up is I use {{{wp_cache_reset()}}} in unit tests
for my plugin to clean up the environment between tests so data is pulled
from the database, not the cache. The existing deprecation message sent
me on a wild goose chase in which I found this ticket, spent time
composing this message (during which I thought to seek a similar method in
the class, which led me to {{{flush()}}}). All in all, a good chunk of
time, wasted. If the message had directed me to the similarly functioning
flush method, I'd have been on my way in moments.
Oh, and can you please add the {{{@since 3.5.0}}} tags to the new function
/ method?
--
Ticket URL: <http://core.trac.wordpress.org/ticket/21434#comment:4>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list