wp_cache_add_global_groups, or multisite prefixes it

On a multisite network the object cache prefixes keys with the blog id unless the group is declared global, so data cached on one site is invisible to another.

add_action( 'init', function () {
    wp_cache_add_global_groups( array( 'turkerdev_shared' ) );
} );

wp_cache_set( 'exchange_rates', $rates, 'turkerdev_shared', 3600 );

// and the mirror image, for anything only useful within one request
// wp_cache_add_non_persistent_groups( array( 'turkerdev_request' ) );

This is invisible on a single site and appears the moment the code runs on a network, which is a long afternoon for anyone who has never seen it. The registration has to happen before any cache call for that group, which in practice means very early — a must-use plugin rather than a theme. The non-persistent counterpart is what keeps a per-request memo out of Redis, which is worth knowing for anything cached inside a loop.