WC_Cache_Helper::get_cache_prefix( string $group )

Get prefix for use with wp_cache_set. Allows all cache in a group to be invalidated at once.


Description Description


Parameters Parameters

$group

(Required) Group of cache to get.


Top ↑

Return Return

(string)


Top ↑

Source Source

File: includes/class-wc-cache-helper.php

	public static function get_cache_prefix( $group ) {
		// Get cache key - uses cache key wc_orders_cache_prefix to invalidate when needed.
		$prefix = wp_cache_get( 'wc_' . $group . '_cache_prefix', $group );

		if ( false === $prefix ) {
			$prefix = microtime();
			wp_cache_set( 'wc_' . $group . '_cache_prefix', $prefix, $group );
		}

		return 'wc_cache_' . $prefix . '_';
	}


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.