swift_performance_cache_folder_prefix

Add custom prefix to the cache folder. It can be used for creating subcache (for example if you would like to create different cache for users who accepted cookie terms)

Parameters

$prefix

string contains cache prefix (default is empty string)

Return

string


Example

// Add "approved" as prefix for users who approved cookie terms
add_filter('swift_performance_cache_folder_prefix', function($prefix){
	if (isset($COOKIE['your-cookie'])){
		return 'approved';
	}

	return $prefix;
});

// Use swift_performance_prebuild_cache_hit action for prebuild
add_action('swift_performance_prebuild_cache_hit', function($permalink){
	$COOKIE['your-cookie'] = 'set';
	Swift_Performance::prebuild_cache_hit($permalink);
});