wpseek.com
A WordPress-centric search engine for devs and theme authors



wp_cache_set_multiple_salted › WordPress Function

Since6.9.0
Deprecatedn/a
wp_cache_set_multiple_salted ( $data, $group, $salt, $expire = 0 )
Parameters: (4)
  • (mixed) $data Data to be stored in the cache for all keys.
    Required: Yes
  • (string) $group Group to which the cached data belongs.
    Required: Yes
  • (string|string[]) $salt The timestamp (or multiple timestamps if an array) indicating when the cache group(s) were last updated.
    Required: Yes
  • (int) $expire Optional. When to expire the cache contents, in seconds. Default 0 (no expiration).
    Required: No
    Default:
Returns:
  • (bool[]) Array of return values, grouped by key. Each value is either
    true on success, or false on failure.
Defined at:
Codex:

Stores multiple pieces of salted data in the cache.



Source

function wp_cache_set_multiple_salted( $data, $group, $salt, $expire = 0 ) {
		$salt      = is_array( $salt ) ? implode( ':', $salt ) : $salt;
		$new_cache = array();
		foreach ( $data as $key => $value ) {
			$new_cache[ $key ] = array(
				'data' => $value,
				'salt' => $salt,
			);
		}
		return wp_cache_set_multiple( $new_cache, $group, $expire );
	}
endif;

if ( ! function_exists( 'wp_cache_switch_to_blog' ) ) :
	/**
	 * Used when switch_to_blog() and restore_current_blog() are called, but
	 * only when a persistent object cache drop-in plugin has omitted the
	 * wp_cache_switch_to_blog() function that was introduced in 3.5.0.
	 *
	 * @link https://core.trac.wordpress.org/ticket/23290
	 *
	 * @since 7.0.0
	 *
	 * @global WP_Object_Cache $wp_object_cache Object cache global instance.
	 *
	 * @param int $blog_id Site ID.
	 */