PHP Memoize Trait
Prefix any method name with an underscore (_
) to memoize calls to that method.
$instance = new Object();
$instance->method(); // normal
$instance->_method(); // memoized
Note: Requires special consideration when your class (or a super class) already implements the magic __call
method.
% phpunit tests/MemoizeTest.php