xtlsoft/cachedrecursion

Easily make cached calls especially in slowly recursions in PHP.

Installs: 6

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 1

Open Issues: 0

pkg:composer/xtlsoft/cachedrecursion

dev-master 2017-12-23 10:59 UTC

This package is auto-updated.

Last update: 2025-09-25 19:34:49 UTC


README

Easily make cached calls especially in slowly recursions in PHP.

Install

composer require xtlsoft/cachedrecursion

Usage

<?php
	
	use \CachedRecursion\Factory;
	
	$func = Factory::cached(
		[
			"n" 
		],
		function($param, $next, $solve){
			
			if($param['n'] == 1) return $solve(1);
			else return $solve($param['n'] * $next($param['n']-1));
			
		}
	);
	
	echo $func(1);

Isn't it easy?