Automattic\WooCommerce\Caching

ObjectCache::get_random_string()protectedWC 1.0

Get a random string to be used to compose the cache key prefix. It should return a different string each time.

Method of the class: ObjectCache{}

No Hooks.

Return

String.

Usage

// protected - for code of main (parent) or child class
$result = $this->get_random_string(): string;

ObjectCache::get_random_string() code WC 7.1.1

protected function get_random_string(): string {
	return dechex( microtime( true ) * 1000 ) . bin2hex( random_bytes( 8 ) );
}