Nette\Caching\Cache::wrap PHP Method

wrap() public method

Caches results of function/method calls.
public wrap ( $function, array $dependencies = NULL ) : Closure
$dependencies array
return Closure
    public function wrap($function, array $dependencies = NULL)
    {
        return function () use($function, $dependencies) {
            $key = [$function, func_get_args()];
            if (is_array($function) && is_object($function[0])) {
                $key[0][0] = get_class($function[0]);
            }
            $data = $this->load($key);
            if ($data === NULL) {
                $data = $this->save($key, Callback::invokeArgs($function, $key[1]), $dependencies);
            }
            return $data;
        };
    }