src/Globals/GlobalsCollection.php
/**
	 * Execute $callback once
	 * if $keys is not provided then cache ID will be generated using callable footprint
	 *
	 * @param mixed    ...$keys
	 * @param callable $callback method result will be set to memory for later use
	 * @return mixed - $callback result
	 */
Execute $callback once
if $keys is not provided then cache ID will be generated using callable footprint

@param mixed    ...$keys
@param callable $callback method result will be set to memory for later use
@return mixed - $callback result
Execute $callback once if $keys is not provided then cache ID will be generated using callable footprint @param mixed ... $keys @param callable $callback method result will be set to memory for later use @return mixed - $callback result
public function once(...$parameters): mixed
	{
		$keys     = [];
		$callback = null;
		foreach ($parameters as $parameter) {
			if (is_callable($parameter)) {
				$callback = $parameter;
			}
			else {
				$keys[] = $parameter;
			}
		}
		if (!$callback) {
			throw new Exception('one of the parameters must be callback');
		}
		if (!$keys) {
			$keys = $callback;
		}
		$cid = hash("crc32b", Str::hashable($keys));
		if (!$this->exists($cid)) {
			$this->set($cid, $callback());
		}
		return $this->get($cid);
	}
public function once ( ... $ parameters ) : mixed { $ keys = [ ] ; $ callback = null ; foreach ( $ parameters as $ parameter ) { if ( is_callable ( $ parameter ) ) { $ callback = $ parameter ; } else { $ keys [ ] = $ parameter ; } } if ( ! $ callback ) { throw new Exception ( 'one of the parameters must be callback' ) ; } if ( ! $ keys ) { $ keys = $ callback ; } $ cid = hash ( " crc32b " , Str :: hashable ( $ keys ) ) ; if ( ! $ this -> exists ( $ cid ) ) { $ this -> set ( $ cid , $ callback ( ) ) ; } return $ this -> get ( $ cid ) ; }
Execute $callback once
 if $keys is not provided then cache ID will be generated using callable footprint
Execute $callback once if $keys is not provided then cache ID will be generated using callable footprint