Index: src/wp-includes/class-wp-network-query.php
===================================================================
--- src/wp-includes/class-wp-network-query.php	(revision 40470)
+++ src/wp-includes/class-wp-network-query.php	(working copy)
@@ -97,49 +97,51 @@
 	 * @param string|array $query {
 	 *     Optional. Array or query string of network query parameters. Default empty.
 	 *
-	 *     @type array        $network__in          Array of network IDs to include. Default empty.
-	 *     @type array        $network__not_in      Array of network IDs to exclude. Default empty.
- 	 *     @type bool         $count                Whether to return a network count (true) or array of network objects.
- 	 *                                              Default false.
- 	 *     @type string       $fields               Network fields to return. Accepts 'ids' (returns an array of network IDs)
- 	 *                                              or empty (returns an array of complete network objects). Default empty.
- 	 *     @type int          $number               Maximum number of networks to retrieve. Default empty (no limit).
- 	 *     @type int          $offset               Number of networks to offset the query. Used to build LIMIT clause.
- 	 *                                              Default 0.
- 	 *     @type bool         $no_found_rows        Whether to disable the `SQL_CALC_FOUND_ROWS` query. Default true.
- 	 *     @type string|array $orderby              Network status or array of statuses. Accepts 'id', 'domain', 'path',
- 	 *                                              'domain_length', 'path_length' and 'network__in'. Also accepts false,
- 	 *                                              an empty array, or 'none' to disable `ORDER BY` clause. Default 'id'.
- 	 *     @type string       $order                How to order retrieved networks. Accepts 'ASC', 'DESC'. Default 'ASC'.
- 	 *     @type string       $domain               Limit results to those affiliated with a given domain. Default empty.
- 	 *     @type array        $domain__in           Array of domains to include affiliated networks for. Default empty.
- 	 *     @type array        $domain__not_in       Array of domains to exclude affiliated networks for. Default empty.
- 	 *     @type string       $path                 Limit results to those affiliated with a given path. Default empty.
- 	 *     @type array        $path__in             Array of paths to include affiliated networks for. Default empty.
- 	 *     @type array        $path__not_in         Array of paths to exclude affiliated networks for. Default empty.
- 	 *     @type string       $search               Search term(s) to retrieve matching networks for. Default empty.
-	 *     @type bool         $update_network_cache Whether to prime the cache for found networks. Default true.
+	 *     @type array        $network__in                  Array of network IDs to include. Default empty.
+	 *     @type array        $network__not_in              Array of network IDs to exclude. Default empty.
+ 	 *     @type bool         $count                        Whether to return a network count (true) or array of network objects.
+ 	 *                                                      Default false.
+ 	 *     @type string       $fields                       Network fields to return. Accepts 'ids' (returns an array of network IDs)
+ 	 *                                                      or empty (returns an array of complete network objects). Default empty.
+ 	 *     @type int          $number                       Maximum number of networks to retrieve. Default empty (no limit).
+ 	 *     @type int          $offset                       Number of networks to offset the query. Used to build LIMIT clause.
+ 	 *                                                      Default 0.
+ 	 *     @type bool         $no_found_rows                Whether to disable the `SQL_CALC_FOUND_ROWS` query. Default true.
+ 	 *     @type string|array $orderby                      Network status or array of statuses. Accepts 'id', 'domain', 'path',
+ 	 *                                                      'domain_length', 'path_length' and 'network__in'. Also accepts false,
+ 	 *                                                      an empty array, or 'none' to disable `ORDER BY` clause. Default 'id'.
+ 	 *     @type string       $order                        How to order retrieved networks. Accepts 'ASC', 'DESC'. Default 'ASC'.
+ 	 *     @type string       $domain                       Limit results to those affiliated with a given domain. Default empty.
+ 	 *     @type array        $domain__in                   Array of domains to include affiliated networks for. Default empty.
+ 	 *     @type array        $domain__not_in               Array of domains to exclude affiliated networks for. Default empty.
+ 	 *     @type string       $path                         Limit results to those affiliated with a given path. Default empty.
+ 	 *     @type array        $path__in                     Array of paths to include affiliated networks for. Default empty.
+ 	 *     @type array        $path__not_in                 Array of paths to exclude affiliated networks for. Default empty.
+ 	 *     @type string       $search                       Search term(s) to retrieve matching networks for. Default empty.
+	 *     @type bool         $update_network_cache         Whether to prime the cache for found networks. Default true.
+	 *     @type bool         $update_network_meta_cache    Whether to update the network meta cache. Default true.
 	 * }
 	 */
 	public function __construct( $query = '' ) {
 		$this->query_var_defaults = array(
-			'network__in'          => '',
-			'network__not_in'      => '',
-			'count'                => false,
-			'fields'               => '',
-			'number'               => '',
-			'offset'               => '',
-			'no_found_rows'        => true,
-			'orderby'              => 'id',
-			'order'                => 'ASC',
-			'domain'               => '',
-			'domain__in'           => '',
-			'domain__not_in'       => '',
-			'path'                 => '',
-			'path__in'             => '',
-			'path__not_in'         => '',
-			'search'               => '',
-			'update_network_cache' => true,
+			'network__in'               => '',
+			'network__not_in'           => '',
+			'count'                     => false,
+			'fields'                    => '',
+			'number'                    => '',
+			'offset'                    => '',
+			'no_found_rows'             => true,
+			'orderby'                   => 'id',
+			'order'                     => 'ASC',
+			'domain'                    => '',
+			'domain__in'                => '',
+			'domain__not_in'            => '',
+			'path'                      => '',
+			'path__in'                  => '',
+			'path__not_in'              => '',
+			'search'                    => '',
+			'update_network_cache'      => true,
+			'update_network_meta_cache' => true,
 		);
 
 		if ( ! empty( $query ) ) {
@@ -248,7 +250,7 @@
 		}
 
 		if ( $this->query_vars['update_network_cache'] ) {
-			_prime_network_caches( $network_ids );
+			_prime_network_caches( $network_ids, $this->query_vars['update_network_meta_cache'] );
 		}
 
 		// Fetch full network objects from the primed cache.
Index: src/wp-includes/meta.php
===================================================================
--- src/wp-includes/meta.php	(revision 40470)
+++ src/wp-includes/meta.php	(working copy)
@@ -34,7 +34,7 @@
 		return false;
 	}
 
-	$object_id = absint( $object_id );
+	$object_id = intval( $object_id );
 	if ( ! $object_id ) {
 		return false;
 	}
@@ -147,7 +147,7 @@
 		return false;
 	}
 
-	$object_id = absint( $object_id );
+	$object_id = intval( $object_id );
 	if ( ! $object_id ) {
 		return false;
 	}
@@ -311,7 +311,7 @@
 		return false;
 	}
 
-	$object_id = absint( $object_id );
+	$object_id = intval( $object_id );
 	if ( ! $object_id && ! $delete_all ) {
 		return false;
 	}
@@ -463,7 +463,7 @@
 		return false;
 	}
 
-	$object_id = absint( $object_id );
+	$object_id = intval( $object_id );
 	if ( ! $object_id ) {
 		return false;
 	}
@@ -530,7 +530,7 @@
 		return false;
 	}
 
-	$object_id = absint( $object_id );
+	$object_id = intval( $object_id );
 	if ( ! $object_id ) {
 		return false;
 	}
Index: src/wp-includes/ms-blogs.php
===================================================================
--- src/wp-includes/ms-blogs.php	(revision 40470)
+++ src/wp-includes/ms-blogs.php	(working copy)
@@ -842,7 +842,7 @@
 			if ( is_array( $global_groups ) ) {
 				wp_cache_add_global_groups( $global_groups );
 			} else {
-				wp_cache_add_global_groups( array( 'users', 'userlogins', 'usermeta', 'user_meta', 'useremail', 'userslugs', 'site-transient', 'site-options', 'blog-lookup', 'blog-details', 'rss', 'global-posts', 'blog-id-cache', 'networks', 'sites', 'site-details' ) );
+				wp_cache_add_global_groups( array( 'users', 'userlogins', 'usermeta', 'user_meta', 'useremail', 'userslugs', 'site-transient', 'site-options', 'blog-lookup', 'blog-details', 'rss', 'global-posts', 'blog-id-cache', 'networks', 'sites', 'site-details', 'site_meta' ) );
 			}
 			wp_cache_add_non_persistent_groups( array( 'counts', 'plugins' ) );
 		}
@@ -916,7 +916,7 @@
 			if ( is_array( $global_groups ) ) {
 				wp_cache_add_global_groups( $global_groups );
 			} else {
-				wp_cache_add_global_groups( array( 'users', 'userlogins', 'usermeta', 'user_meta', 'useremail', 'userslugs', 'site-transient', 'site-options', 'blog-lookup', 'blog-details', 'rss', 'global-posts', 'blog-id-cache', 'networks', 'sites', 'site-details' ) );
+				wp_cache_add_global_groups( array( 'users', 'userlogins', 'usermeta', 'user_meta', 'useremail', 'userslugs', 'site-transient', 'site-options', 'blog-lookup', 'blog-details', 'rss', 'global-posts', 'blog-id-cache', 'networks', 'sites', 'site-details', 'site_meta' ) );
 			}
 			wp_cache_add_non_persistent_groups( array( 'counts', 'plugins' ) );
 		}
@@ -1170,7 +1170,7 @@
 
 	foreach ( (array) $ids as $id ) {
 		wp_cache_delete( $id, 'networks' );
-
+		wp_cache_delete( $id, 'site_meta' );
 		/**
 		 * Fires immediately after a network has been removed from the object cache.
 		 *
@@ -1192,34 +1192,42 @@
  * cache using the network group with the key using the ID of the networks.
  *
  * @since 4.6.0
+ * @since 4.8.0 Introduced the `$update_meta_cache` parameter.
  *
- * @param array $networks Array of network row objects.
+ * @param array $networks          Array of network row objects.
+ * @param bool  $update_meta_cache Optional. Whether to update the meta cache. Default true.
  */
-function update_network_cache( $networks ) {
+function update_network_cache( $networks, $update_meta_cache = true ) {
 	foreach ( (array) $networks as $network ) {
 		wp_cache_add( $network->id, $network, 'networks' );
 	}
+
+	if ( $update_meta_cache ) {
+		update_networkmeta_cache( wp_list_pluck( $networks, 'id' ) );
+	}
 }
 
 /**
  * Adds any networks from the given IDs to the cache that do not already exist in cache.
  *
  * @since 4.6.0
+ * @since 4.8.0 Introduced the `$update_meta_cache` parameter.
  * @access private
  *
  * @see update_network_cache()
  * @global wpdb $wpdb WordPress database abstraction object.
  *
- * @param array $network_ids Array of network IDs.
+ * @param array $network_ids       Array of network IDs.
+ * @param bool  $update_meta_cache Optional. Whether to update the meta cache. Default true.
  */
-function _prime_network_caches( $network_ids ) {
+function _prime_network_caches( $network_ids, $update_meta_cache = true ) {
 	global $wpdb;
 
 	$non_cached_ids = _get_non_cached_ids( $network_ids, 'networks' );
-	if ( !empty( $non_cached_ids ) ) {
-		$fresh_networks = $wpdb->get_results( sprintf( "SELECT $wpdb->site.* FROM $wpdb->site WHERE id IN (%s)", join( ",", array_map( 'intval', $non_cached_ids ) ) ) );
+	if ( ! empty( $non_cached_ids ) ) {
+		$fresh_networks = $wpdb->get_results( sprintf( "SELECT * FROM {$wpdb->site} WHERE id IN (%s)", join( ",", array_map( 'intval', $non_cached_ids ) ) ) );
 
-		update_network_cache( $fresh_networks );
+		update_network_cache( $fresh_networks, $update_meta_cache );
 	}
 }
 
Index: src/wp-includes/ms-functions.php
===================================================================
--- src/wp-includes/ms-functions.php	(revision 40470)
+++ src/wp-includes/ms-functions.php	(working copy)
@@ -2517,3 +2517,106 @@
 	 */
 	return apply_filters( 'subdirectory_reserved_names', $names );
 }
+
+/**
+ * Add metadata to a network.
+ *
+ * @since 4.8.0
+ *
+ * @param int    $id         Network ID.
+ * @param string $meta_key   Metadata name.
+ * @param mixed  $meta_value Metadata value. Must be serializable if non-scalar.
+ * @param bool   $unique     Optional. Whether the same key should not be added.
+ *                           Default false.
+ * @return int|false Meta ID on success, false on failure.
+ */
+function add_network_meta( $id, $meta_key, $meta_value, $unique = false ) {
+	return add_metadata( 'site', $id, $meta_key, $meta_value, $unique );
+}
+
+/**
+ * Remove from a network, metadata matching key and/or value.
+ *
+ * You can match based on the key, or key and value. Removing based on key and
+ * value, will keep from removing duplicate metadata with the same key. It also
+ * allows removing all metadata matching key, if needed.
+ *
+ * @since 4.8.0
+ *
+ * @param int    $id         Network ID.
+ * @param string $meta_key   Metadata name.
+ * @param mixed  $meta_value Optional. Metadata value. Must be serializable if
+ *                           non-scalar. Default empty.
+ * @return bool True on success, false on failure.
+ */
+function delete_network_meta( $id, $meta_key, $meta_value = '' ) {
+	return delete_metadata( 'site', $id, $meta_key, $meta_value );
+}
+
+/**
+ * Retrieve from a network, metadata value by key.
+ *
+ * @since 4.8.0
+ *
+ * @param int    $id        Network ID.
+ * @param string $meta_key  Optional. The meta key to retrieve. By default, returns
+ *                          data for all keys. Default empty.
+ * @param bool   $single    Optional. Whether to return a single value. Default false.
+ * @return mixed Will be an array if $single is false. Will be value of meta data
+ *               field if $single is true.
+ */
+function get_network_meta( $id, $meta_key = '', $single = false ) {
+	return get_metadata( 'site', $id, $meta_key, $single );
+}
+
+/**
+ * Update metadata for a network ID, and/or key, and/or value.
+ *
+ * Use the $prev_value parameter to differentiate between meta fields with the
+ * same key and network ID.
+ *
+ * If the meta field for the network does not exist, it will be added.
+ *
+ * @since 4.8.0
+ *
+ * @param int    $id         Network ID.
+ * @param string $meta_key   Metadata key.
+ * @param mixed  $meta_value Metadata value. Must be serializable if non-scalar.
+ * @param mixed  $prev_value Optional. Previous value to check before removing.
+ *                           Default empty.
+ * @return int|bool Meta ID if the key didn't exist, true on successful update,
+ *                  false on failure.
+ */
+function update_network_meta( $id, $meta_key, $meta_value, $prev_value = '' ) {
+	return update_metadata( 'site', $id, $meta_key, $meta_value, $prev_value );
+}
+
+/**
+ * Delete everything from network meta matching meta key.
+ *
+ * @since 4.8.0
+ *
+ * @param string $network_meta_key Key to search for when deleting.
+ *
+ * @return bool Whether the network meta key was deleted from the database.
+ */
+function delete_network_meta_by_key( $network_meta_key ) {
+	return delete_metadata( 'site', null, $network_meta_key, '', true );
+}
+
+/**
+ * Updates metadata cache for list of network IDs.
+ *
+ * Performs SQL query to retrieve the metadata for the network IDs and updates the
+ * metadata cache for the posts. Therefore, the functions, which call this
+ * function, do not need to perform SQL queries on their own.
+ *
+ * @since 4.8.0
+ *
+ * @param array $network_ids List of network IDs.
+ * @return array|false Returns false if there is nothing to update or an array
+ *                     of metadata.
+ */
+function update_networkmeta_cache( $network_ids) {
+	return update_meta_cache( 'site', $network_ids );
+}
Index: src/wp-includes/option.php
===================================================================
--- src/wp-includes/option.php	(revision 40470)
+++ src/wp-includes/option.php	(working copy)
@@ -205,31 +205,24 @@
  *
  * @since 3.0.0
  *
- * @global wpdb $wpdb WordPress database abstraction object.
+ * @see update_networkmeta_cache()
  *
- * @param int $site_id Optional site ID for which to query the options. Defaults to the current site.
+ * @param int $network_id Optional network ID for which to query the options. Defaults to the current site.
  */
-function wp_load_core_site_options( $site_id = null ) {
-	global $wpdb;
+function wp_load_core_site_options( $network_id = null ) {
 
-	if ( ! is_multisite() || wp_using_ext_object_cache() || wp_installing() )
+	if ( ! is_multisite() || wp_using_ext_object_cache() || wp_installing() ) {
 		return;
+	}
 
-	if ( empty($site_id) )
-		$site_id = $wpdb->siteid;
-
-	$core_options = array('site_name', 'siteurl', 'active_sitewide_plugins', '_site_transient_timeout_theme_roots', '_site_transient_theme_roots', 'site_admins', 'can_compress_scripts', 'global_terms_enabled', 'ms_files_rewriting' );
-
-	$core_options_in = "'" . implode("', '", $core_options) . "'";
-	$options = $wpdb->get_results( $wpdb->prepare("SELECT meta_key, meta_value FROM $wpdb->sitemeta WHERE meta_key IN ($core_options_in) AND site_id = %d", $site_id) );
-
-	foreach ( $options as $option ) {
-		$key = $option->meta_key;
-		$cache_key = "{$site_id}:$key";
-		$option->meta_value = maybe_unserialize( $option->meta_value );
+	$network_id = (int) $network_id;
 
-		wp_cache_set( $cache_key, $option->meta_value, 'site-options' );
+	// Fallback to the current network if a network ID is not specified.
+	if ( empty( $network_id ) ) {
+		$network_id = get_current_network_id();
 	}
+
+	update_networkmeta_cache( $network_id );
 }
 
 /**
@@ -1080,8 +1073,10 @@
  * Retrieve a network's option value based on the option name.
  *
  * @since 4.4.0
+ * @since 4.8.0 Modified into wrapper for get_network_meta()
  *
  * @see get_option()
+ * @see get_network_meta()
  *
  * @global wpdb $wpdb
  *
@@ -1091,7 +1086,6 @@
  * @return mixed Value set for the option.
  */
 function get_network_option( $network_id, $option, $default = false ) {
-	global $wpdb;
 
 	if ( $network_id && ! is_numeric( $network_id ) ) {
 		return false;
@@ -1127,55 +1121,30 @@
 		return $pre;
 	}
 
-	// prevent non-existent options from triggering multiple queries
-	$notoptions_key = "$network_id:notoptions";
-	$notoptions = wp_cache_get( $notoptions_key, 'site-options' );
-
-	if ( isset( $notoptions[ $option ] ) ) {
-
-		/**
-		 * Filters a specific default network option.
-		 *
-		 * The dynamic portion of the hook name, `$option`, refers to the option name.
-		 *
-		 * @since 3.4.0
-		 * @since 4.4.0 The `$option` parameter was added.
-		 * @since 4.7.0 The `$network_id` parameter was added.
-		 *
-		 * @param mixed  $default    The value to return if the site option does not exist
-		 *                           in the database.
-		 * @param string $option     Option name.
-		 * @param int    $network_id ID of the network.
-		 */
-		return apply_filters( "default_site_option_{$option}", $default, $option, $network_id );
-	}
+	/**
+	 * Filters a specific default network option.
+	 *
+	 * The dynamic portion of the hook name, `$option`, refers to the option name.
+	 *
+	 * @since 3.4.0
+	 * @since 4.4.0 The `$option` parameter was added.
+	 * @since 4.7.0 The `$network_id` parameter was added.
+	 *
+	 * @param mixed  $default    The value to return if the site option does not exist
+	 *                           in the database.
+	 * @param string $option     Option name.
+	 * @param int    $network_id ID of the network.
+	 */
+	$default = apply_filters( 'default_site_option_' . $option, $default, $option, $network_id );
 
 	if ( ! is_multisite() ) {
-		/** This filter is documented in wp-includes/option.php */
-		$default = apply_filters( 'default_site_option_' . $option, $default, $option, $network_id );
 		$value = get_option( $option, $default );
 	} else {
-		$cache_key = "$network_id:$option";
-		$value = wp_cache_get( $cache_key, 'site-options' );
-
-		if ( ! isset( $value ) || false === $value ) {
-			$row = $wpdb->get_row( $wpdb->prepare( "SELECT meta_value FROM $wpdb->sitemeta WHERE meta_key = %s AND site_id = %d", $option, $network_id ) );
-
-			// Has to be get_row instead of get_var because of funkiness with 0, false, null values
-			if ( is_object( $row ) ) {
-				$value = $row->meta_value;
-				$value = maybe_unserialize( $value );
-				wp_cache_set( $cache_key, $value, 'site-options' );
-			} else {
-				if ( ! is_array( $notoptions ) ) {
-					$notoptions = array();
-				}
-				$notoptions[ $option ] = true;
-				wp_cache_set( $notoptions_key, $notoptions, 'site-options' );
-
-				/** This filter is documented in wp-includes/option.php */
-				$value = apply_filters( 'default_site_option_' . $option, $default, $option, $network_id );
-			}
+		$meta = get_network_meta( $network_id, $option );
+		if ( is_array( $meta ) && ! empty( $meta ) ) {
+			$value = array_shift( $meta );
+		} else {
+			$value = $default;
 		}
 	}
 
@@ -1202,8 +1171,10 @@
  * Existing options will not be updated.
  *
  * @since 4.4.0
+ * @since 4.8.0 Modified into wrapper for add_network_meta()
  *
  * @see add_option()
+ * @see add_network_meta()
  *
  * @global wpdb $wpdb
  *
@@ -1213,7 +1184,6 @@
  * @return bool False if option was not added and true if option was added.
  */
 function add_network_option( $network_id, $option, $value ) {
-	global $wpdb;
 
 	if ( $network_id && ! is_numeric( $network_id ) ) {
 		return false;
@@ -1244,38 +1214,11 @@
 	 */
 	$value = apply_filters( "pre_add_site_option_{$option}", $value, $option, $network_id );
 
-	$notoptions_key = "$network_id:notoptions";
-
 	if ( ! is_multisite() ) {
 		$result = add_option( $option, $value, '', 'no' );
 	} else {
-		$cache_key = "$network_id:$option";
-
-		// Make sure the option doesn't already exist. We can check the 'notoptions' cache before we ask for a db query
-		$notoptions = wp_cache_get( $notoptions_key, 'site-options' );
-		if ( ! is_array( $notoptions ) || ! isset( $notoptions[ $option ] ) ) {
-			if ( false !== get_network_option( $network_id, $option, false ) ) {
-				return false;
-			}
-		}
-
-		$value = sanitize_option( $option, $value );
-
-		$serialized_value = maybe_serialize( $value );
-		$result = $wpdb->insert( $wpdb->sitemeta, array( 'site_id'    => $network_id, 'meta_key'   => $option, 'meta_value' => $serialized_value ) );
-
-		if ( ! $result ) {
-			return false;
-		}
-
-		wp_cache_set( $cache_key, $value, 'site-options' );
-
-		// This option exists now
-		$notoptions = wp_cache_get( $notoptions_key, 'site-options' ); // yes, again... we need it to be fresh
-		if ( is_array( $notoptions ) && isset( $notoptions[ $option ] ) ) {
-			unset( $notoptions[ $option ] );
-			wp_cache_set( $notoptions_key, $notoptions, 'site-options' );
-		}
+		$value  = sanitize_option( $option, $value );
+		$result = add_network_meta( $network_id, $option, $value, true );
 	}
 
 	if ( $result ) {
@@ -1317,8 +1260,10 @@
  * Removes a network option by name.
  *
  * @since 4.4.0
+ * @since 4.8.0 Modified into wrapper for delete_network_meta()
  *
  * @see delete_option()
+ * @see delete_network_meta()
  *
  * @global wpdb $wpdb
  *
@@ -1327,7 +1272,6 @@
  * @return bool True, if succeed. False, if failure.
  */
 function delete_network_option( $network_id, $option ) {
-	global $wpdb;
 
 	if ( $network_id && ! is_numeric( $network_id ) ) {
 		return false;
@@ -1357,14 +1301,7 @@
 	if ( ! is_multisite() ) {
 		$result = delete_option( $option );
 	} else {
-		$row = $wpdb->get_row( $wpdb->prepare( "SELECT meta_id FROM {$wpdb->sitemeta} WHERE meta_key = %s AND site_id = %d", $option, $network_id ) );
-		if ( is_null( $row ) || ! $row->meta_id ) {
-			return false;
-		}
-		$cache_key = "$network_id:$option";
-		wp_cache_delete( $cache_key, 'site-options' );
-
-		$result = $wpdb->delete( $wpdb->sitemeta, array( 'meta_key' => $option, 'site_id' => $network_id ) );
+		$result = delete_network_meta( $network_id, $option );
 	}
 
 	if ( $result ) {
@@ -1404,8 +1341,10 @@
  * Update the value of a network option that was already added.
  *
  * @since 4.4.0
+ * @since 4.8.0 Modified into wrapper for update_network_meta()
  *
  * @see update_option()
+ * @see update_network_meta()
  *
  * @global wpdb $wpdb
  *
@@ -1415,7 +1354,6 @@
  * @return bool False if value was not updated and true if value was updated.
  */
 function update_network_option( $network_id, $option, $value ) {
-	global $wpdb;
 
 	if ( $network_id && ! is_numeric( $network_id ) ) {
 		return false;
@@ -1449,33 +1387,15 @@
 	 */
 	$value = apply_filters( "pre_update_site_option_{$option}", $value, $old_value, $option, $network_id );
 
-	if ( $value === $old_value ) {
-		return false;
-	}
-
 	if ( false === $old_value ) {
 		return add_network_option( $network_id, $option, $value );
 	}
 
-	$notoptions_key = "$network_id:notoptions";
-	$notoptions = wp_cache_get( $notoptions_key, 'site-options' );
-	if ( is_array( $notoptions ) && isset( $notoptions[ $option ] ) ) {
-		unset( $notoptions[ $option ] );
-		wp_cache_set( $notoptions_key, $notoptions, 'site-options' );
-	}
-
 	if ( ! is_multisite() ) {
 		$result = update_option( $option, $value, 'no' );
 	} else {
-		$value = sanitize_option( $option, $value );
-
-		$serialized_value = maybe_serialize( $value );
-		$result = $wpdb->update( $wpdb->sitemeta, array( 'meta_value' => $serialized_value ), array( 'site_id' => $network_id, 'meta_key' => $option ) );
-
-		if ( $result ) {
-			$cache_key = "$network_id:$option";
-			wp_cache_set( $cache_key, $value, 'site-options' );
-		}
+		$value  = sanitize_option( $option, $value );
+		$result = update_network_meta( $network_id, $option, $value, $old_value );
 	}
 
 	if ( $result ) {
Index: src/wp-settings.php
===================================================================
--- src/wp-settings.php	(revision 40470)
+++ src/wp-settings.php	(working copy)
@@ -94,8 +94,10 @@
 
 // Load early WordPress files.
 require( ABSPATH . WPINC . '/compat.php' );
-require( ABSPATH . WPINC . '/class-wp-list-util.php' );
 require( ABSPATH . WPINC . '/functions.php' );
+require( ABSPATH . WPINC . '/formatting.php' );
+require( ABSPATH . WPINC . '/meta.php' );
+require( ABSPATH . WPINC . '/class-wp-list-util.php' );
 require( ABSPATH . WPINC . '/class-wp-matchesmapregex.php' );
 require( ABSPATH . WPINC . '/class-wp.php' );
 require( ABSPATH . WPINC . '/class-wp-error.php' );
@@ -119,6 +121,7 @@
 if ( is_multisite() ) {
 	require( ABSPATH . WPINC . '/class-wp-site-query.php' );
 	require( ABSPATH . WPINC . '/class-wp-network-query.php' );
+	require( ABSPATH . WPINC . '/ms-functions.php' );
 	require( ABSPATH . WPINC . '/ms-blogs.php' );
 	require( ABSPATH . WPINC . '/ms-settings.php' );
 } elseif ( ! defined( 'MULTISITE' ) ) {
@@ -142,7 +145,6 @@
 // Load most of WordPress.
 require( ABSPATH . WPINC . '/class-wp-walker.php' );
 require( ABSPATH . WPINC . '/class-wp-ajax-response.php' );
-require( ABSPATH . WPINC . '/formatting.php' );
 require( ABSPATH . WPINC . '/capabilities.php' );
 require( ABSPATH . WPINC . '/class-wp-roles.php' );
 require( ABSPATH . WPINC . '/class-wp-role.php' );
@@ -157,7 +159,6 @@
 require( ABSPATH . WPINC . '/class-wp-user-query.php' );
 require( ABSPATH . WPINC . '/class-wp-session-tokens.php' );
 require( ABSPATH . WPINC . '/class-wp-user-meta-session-tokens.php' );
-require( ABSPATH . WPINC . '/meta.php' );
 require( ABSPATH . WPINC . '/class-wp-meta-query.php' );
 require( ABSPATH . WPINC . '/class-wp-metadata-lazyloader.php' );
 require( ABSPATH . WPINC . '/general-template.php' );
@@ -244,7 +245,6 @@
 
 // Load multisite-specific files.
 if ( is_multisite() ) {
-	require( ABSPATH . WPINC . '/ms-functions.php' );
 	require( ABSPATH . WPINC . '/ms-default-filters.php' );
 	require( ABSPATH . WPINC . '/ms-deprecated.php' );
 }
Index: tests/phpunit/includes/testcase.php
===================================================================
--- tests/phpunit/includes/testcase.php	(revision 40470)
+++ tests/phpunit/includes/testcase.php	(working copy)
@@ -301,7 +301,7 @@
 			$wp_object_cache->__remoteset();
 		}
 		wp_cache_flush();
-		wp_cache_add_global_groups( array( 'users', 'userlogins', 'usermeta', 'user_meta', 'useremail', 'userslugs', 'site-transient', 'site-options', 'blog-lookup', 'blog-details', 'rss', 'global-posts', 'blog-id-cache', 'networks', 'sites', 'site-details' ) );
+		wp_cache_add_global_groups( array( 'users', 'userlogins', 'usermeta', 'user_meta', 'useremail', 'userslugs', 'site-transient', 'site-options', 'blog-lookup', 'blog-details', 'rss', 'global-posts', 'blog-id-cache', 'networks', 'sites', 'site-details', 'site_meta' ) );
 		wp_cache_add_non_persistent_groups( array( 'comment', 'counts', 'plugins' ) );
 	}
 
Index: tests/phpunit/tests/cache.php
===================================================================
--- tests/phpunit/tests/cache.php	(revision 40470)
+++ tests/phpunit/tests/cache.php	(working copy)
@@ -22,7 +22,7 @@
 		global $wp_object_cache;
 		$cache_class = get_class( $wp_object_cache );
 		$cache = new $cache_class();
-		$cache->add_global_groups( array( 'global-cache-test', 'users', 'userlogins', 'usermeta', 'user_meta', 'useremail', 'userslugs', 'site-transient', 'site-options', 'blog-lookup', 'blog-details', 'rss', 'global-posts', 'blog-id-cache', 'networks', 'sites', 'site-details' ) );
+		$cache->add_global_groups( array( 'global-cache-test', 'users', 'userlogins', 'usermeta', 'user_meta', 'useremail', 'userslugs', 'site-transient', 'site-options', 'blog-lookup', 'blog-details', 'rss', 'global-posts', 'blog-id-cache', 'networks', 'sites', 'site-details', 'site_meta' ) );
 		return $cache;
 	}
 
Index: tests/phpunit/tests/multisite/network.php
===================================================================
--- tests/phpunit/tests/multisite/network.php	(revision 40470)
+++ tests/phpunit/tests/multisite/network.php	(working copy)
@@ -202,7 +202,7 @@
 
 		$site_count = get_blog_count( self::$different_network_id );
 
-		$this->assertSame( count( self::$different_site_ids ), $site_count );
+		$this->assertEquals( count( self::$different_site_ids ), $site_count );
 	}
 
 	/**
Index: tests/phpunit/tests/multisite/networkMeta.php
===================================================================
--- tests/phpunit/tests/multisite/networkMeta.php	(revision 0)
+++ tests/phpunit/tests/multisite/networkMeta.php	(working copy)
@@ -0,0 +1,143 @@
+<?php
+
+if ( is_multisite() ) :
+/**
+ * @group ms-site
+ * @group multisite
+ * @group meta
+ * @ticket 37923
+ */
+class Tests_Multisite_Network_Meta extends WP_UnitTestCase {
+	protected static $network_id;
+	protected static $network_id2;
+
+	public static function wpSetUpBeforeClass( $factory ) {
+		self::$network_id = $factory->network->create( array( 'domain' => 'wordpress.org', 'path' => '/' ) );
+		self::$network_id2 = $factory->network->create( array( 'domain' => 'wordpress.org', 'path' => '/foo/' ) );
+	}
+
+	public static function wpTearDownAfterClass() {
+		global $wpdb;
+
+		foreach ( array( self::$network_id, self::$network_id2 ) as $network_id ) {
+			$network_meta_ids = $wpdb->get_col( $wpdb->prepare( "SELECT meta_id FROM $wpdb->sitemeta WHERE site_id = %d ", $network_id ) );
+			foreach ( $network_meta_ids as $mid ) {
+				delete_metadata_by_mid( 'site', $mid );
+			}
+			$wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->site} WHERE id= %d", $network_id ) );
+			clean_network_cache( $network_id );
+		}
+	}
+
+	public function test_add() {
+		
+		$this->assertNotEmpty( add_network_meta( self::$network_id, 'foo', 'bar' ) );
+	}
+
+	public function test_add_unique() {
+
+		$this->assertNotEmpty( add_network_meta( self::$network_id, 'foo', 'bar' ) );
+		$this->assertFalse( add_network_meta( self::$network_id, 'foo', 'bar', true ) );
+	}
+
+	public function test_delete() {
+
+		add_network_meta( self::$network_id, 'foo', 'bar' );
+
+		$this->assertTrue( delete_network_meta( self::$network_id, 'foo' ) );
+	}
+
+	public function test_delete_with_invalid_meta_key_should_return_false() {
+
+		$this->assertFalse( delete_network_meta( self::$network_id, 'foo' ) );
+	}
+
+	public function test_delete_should_respect_meta_value() {
+
+		add_network_meta( self::$network_id, 'foo', 'bar' );
+		add_network_meta( self::$network_id, 'foo', 'baz' );
+
+		$this->assertTrue( delete_network_meta( self::$network_id, 'foo', 'bar' ) );
+
+		$metas = get_network_meta( self::$network_id, 'foo', false );
+		$this->assertSame( array( 'baz' ), $metas );
+	}
+
+	public function test_get_with_no_key_should_fetch_all_keys() {
+
+		add_network_meta( self::$network_id, 'foo', 'bar' );
+		add_network_meta( self::$network_id, 'foo1', 'baz' );
+
+		$found = get_network_meta( self::$network_id );
+
+		$expected = array(
+			'foo'  => array( 'bar' ),
+			'foo1' => array( 'baz' ),
+		);
+		foreach ( $expected as $key => $value ) {
+			$this->assertArrayHasKey( $key, $found );
+			$this->assertEquals( $value, $found[ $key ] );
+		}
+
+	}
+
+	public function test_get_with_key_should_fetch_all_for_key() {
+
+		add_network_meta( self::$network_id, 'foo', 'bar' );
+		add_network_meta( self::$network_id, 'foo', 'baz' );
+		add_network_meta( self::$network_id, 'foo1', 'baz' );
+
+		$found = get_network_meta( self::$network_id, 'foo' );
+		$expected = array( 'bar', 'baz' );
+
+		$this->assertEqualSets( $expected, $found );
+	}
+
+	public function test_get_should_respect_single_true() {
+
+		add_network_meta( self::$network_id, 'foo', 'bar' );
+		add_network_meta( self::$network_id, 'foo', 'baz' );
+
+		$found = get_network_meta( self::$network_id, 'foo', true );
+		$this->assertEquals( 'bar', $found );
+	}
+
+	public function test_update_should_pass_to_add_when_no_value_exists_for_key() {
+
+		$actual = update_network_meta( self::$network_id, 'foo', 'bar' );
+		$this->assertInternalType( 'int', $actual );
+		$this->assertNotEmpty( $actual );
+
+		$meta = get_network_meta( self::$network_id, 'foo', true );
+		$this->assertSame( 'bar', $meta );
+	}
+
+	public function test_update_should_return_true_when_updating_existing_value_for_key() {
+
+		add_network_meta( self::$network_id, 'foo', 'bar' );
+
+		$actual = update_network_meta( self::$network_id, 'foo', 'baz' );
+		$this->assertTrue( $actual );
+
+		$meta = get_network_meta( self::$network_id, 'foo', true );
+		$this->assertSame( 'baz', $meta );
+	}
+
+	public function test_delete_by_key() {
+
+		add_network_meta( self::$network_id, 'unique_delete_by_key', 'value', true );
+		add_network_meta( self::$network_id2, 'unique_delete_by_key', 'value', true );
+
+		$this->assertEquals( 'value', get_network_meta( self::$network_id, 'unique_delete_by_key', true ) );
+		$this->assertEquals( 'value', get_network_meta( self::$network_id2, 'unique_delete_by_key', true ) );
+
+		$this->assertTrue( delete_network_meta_by_key( 'unique_delete_by_key' ) );
+
+		$this->assertEquals( '', get_network_meta( self::$network_id, 'unique_delete_by_key', true ) );
+		$this->assertEquals( '', get_network_meta( self::$network_id2, 'unique_delete_by_key', true ) );
+	}
+
+	
+}
+
+endif;
Index: tests/phpunit/tests/option/multisite.php
===================================================================
--- tests/phpunit/tests/option/multisite.php	(revision 40470)
+++ tests/phpunit/tests/option/multisite.php	(working copy)
@@ -144,25 +144,6 @@
 		//$this->assertFalse( get_option( $key2 ) ); // check get_option()
 	}
 
-	/**
-	 * @group multisite
-	 */
-	function test_site_notoptions() {
-		global $wpdb;
-		$notoptions_key = "{$wpdb->siteid}:notoptions";
-
-		$_notoptions = wp_cache_get( 'notoptions', 'site-options' );
-		$this->assertEmpty( $_notoptions );
-		$_notoptions1 = wp_cache_get( $notoptions_key, 'site-options' );
-		$this->assertEmpty( $_notoptions1 );
-
-		get_site_option( 'burrito' );
-
-		$notoptions = wp_cache_get( 'notoptions', 'site-options' );
-		$this->assertEmpty( $notoptions );
-		$notoptions1 = wp_cache_get( $notoptions_key, 'site-options' );
-		$this->assertNotEmpty( $notoptions1 );
-	}
 
 	function test_users_can_register_signup_filter() {
 
