Follows-up
da3443bfa2a.
It won't work across different requests due to use of uniqid()
internally (so we may want to use a HashBagOStuff for closure
instead to save memory in APC). But at least assert that it does
and is intended to work.
Change-Id: Id4b42e8717f62f733eee8fcc9a4ab6c0f5c1f2fe
* in an instance property rather than APC.
*/
class ArrayBackedMemoizedCallable extends MemoizedCallable {
- public $cache = [];
+ private $cache = [];
protected function fetchResult( $key, &$success ) {
if ( array_key_exists( $key, $this->cache ) ) {
$this->readAttribute( $a, 'callableName' ),
$this->readAttribute( $b, 'callableName' )
);
+
+ $c = new ArrayBackedMemoizedCallable( function () {
+ return rand();
+ } );
+ $this->assertEquals( $c->invokeArgs(), $c->invokeArgs(), 'memoized random' );
}
/**