xtlsoft / cachedrecursion
在PHP中轻松实现缓存调用,尤其是在缓慢的递归中。
dev-master
2017-12-23 10:59 UTC
Requires
- php: >=5.4
This package is auto-updated.
Last update: 2024-09-25 17:05:30 UTC
README
在PHP中轻松实现缓存调用,尤其是在缓慢的递归中。
安装
composer require xtlsoft/cachedrecursion
用法
<?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);
难道不难吗?