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



wp_cache_set_salted › WordPress Function

Since6.9.0
Deprecatedn/a
wp_cache_set_salted ( $cache_key, $data, $group, $salt, $expire = 0 )
Parameters: (5)
  • (string) $cache_key The cache key under which to store the data.
    Required: Yes
  • (mixed) $data The data to be cached.
    Required: Yes
  • (string) $group The cache group to which the 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) True on success, false on failure.
Defined at:
Codex:

Stores salted data in the cache.



Source

function wp_cache_set_salted( $cache_key, $data, $group, $salt, $expire = 0 ) {
		$salt = is_array( $salt ) ? implode( ':', $salt ) : $salt;
		return wp_cache_set(
			$cache_key,
			array(
				'data' => $data,
				'salt' => $salt,
			),
			$group,
			$expire
		);
	}
endif;

if ( ! function_exists( 'wp_cache_get_multiple_salted' ) ) :
	/**
	 * Retrieves multiple items from the cache, only considering valid and unchanged items.
	 *
	 * @since 6.9.0
	 *
	 * @param array           $cache_keys Array of cache keys to retrieve.
	 * @param string          $group      The group of the cache to check.
	 * @param string|string[] $salt       The timestamp (or multiple timestamps if an array) indicating when the cache group(s) were last updated.
	 * @return array An associative array containing cache values. Values are `false` if they are not found or outdated.
	 */