60 if ( !is_callable(
$callable,
false, $this->callableName ) ) {
61 throw new InvalidArgumentException(
62 'Argument 1 passed to MemoizedCallable::__construct() must ' .
63 'be an instance of callable; ' . gettype(
$callable ) .
' given'
67 if ( $this->callableName ===
'Closure::__invoke' ) {
69 $this->callableName .= uniqid();
73 $this->ttl = min( max(
$ttl, 1 ), 86400 );
85 if ( function_exists(
'apc_fetch' ) ) {
87 } elseif ( function_exists(
'apcu_fetch' ) ) {
100 if ( function_exists(
'apc_store' ) ) {
101 apc_store( $key, $result, $this->ttl );
102 } elseif ( function_exists(
'apcu_store' ) ) {
103 apcu_store( $key, $result, $this->ttl );
115 foreach (
$args as $arg ) {
116 if ( $arg !==
null && !is_scalar( $arg ) ) {
117 throw new InvalidArgumentException(
118 'MemoizedCallable::invoke() called with non-scalar ' .
125 $key = __CLASS__ .
':' . $this->callableName .
':' . $hash;
159 return $instance->invokeArgs(
$args );