Func
Less than 1 minute
Func
Class Func.
class Func extends \Hazaar\Cache\AdapterExtends: Hazaar\Cache\Adapter
This class extends the Cache class and provides functionality to cache function calls.
Methods
__construct
public __construct(?string $backend, Func\Options $options = 'new Func\Options()'): voidParameters
| Parameter | Type | Description |
|---|---|---|
$backend | string | |
$options | Hazaar\Cache\Func\Options |
call
Calls a function with the provided arguments and caches the result based on the configuration.
public call(callable $callable, mixed $args): mixedReturns: mixed
This method retrieves the function name and its arguments, generates a cache key, and checks whether the function result should be cached based on the options provided. If caching is enabled and the result is found in the cache, it returns the cached result. Otherwise, it calls the function, caches the result, and then returns it.
Parameters
| Parameter | Type | Description |
|---|---|---|
$callable | callable | the function to call and cache the result of |
$args | mixed |
generateKey
Generates a unique key string for a given function and its arguments.
private generateKey(callable $callable, array $args): stringReturns: string
Parameters
| Parameter | Type | Description |
|---|---|---|
$callable | callable | |
$args | array | the array of parameters to be passed to the function |
Generated by Hazaar API Doc Generator on Fri, 04 Sep 2026 23:32:16 +0000