PHP Class Ouzo\Utilities\Suppliers

Datei anzeigen Open project: letsdrink/ouzo Class Usage Examples

Public Methods

Method Description
memoize ( callable $function ) : Ouzo\Utilities\Supplier\Supplier Returns a supplier which caches the callback result and returns that value on subsequent calls to get().
memoizeWithExpiration ( callable $function, integer $expireTime = 3600 ) : Ouzo\Utilities\Supplier\Supplier Returns a supplier which caches the callback result and removes the cached value after specified time.

Method Details

memoize() public static method

Returns a supplier which caches the callback result and returns that value on subsequent calls to get().
public static memoize ( callable $function ) : Ouzo\Utilities\Supplier\Supplier
$function callable
return Ouzo\Utilities\Supplier\Supplier

memoizeWithExpiration() public static method

Subsequent calls to get() return the cached value if expiration time has not passed. Time is passed in seconds.
public static memoizeWithExpiration ( callable $function, integer $expireTime = 3600 ) : Ouzo\Utilities\Supplier\Supplier
$function callable
$expireTime integer
return Ouzo\Utilities\Supplier\Supplier