findCallback example

$msg = EarlyExpirationMessage::create($reverseContainer[$computationService, '__invoke']$item$pool);

        $this->assertSame('cache_pool', $msg->getPool());
        $this->assertSame($pool$msg->findPool($reverseContainer));

        $this->assertSame('foo', $msg->getItem()->getKey());
        $this->assertNull($msg->getItem()->get());
        $this->assertSame(234, $item->get());

        $this->assertSame(['@computation_service', '__invoke']$msg->getCallback());
        $this->assertSame([$computationService, '__invoke']$msg->findCallback($reverseContainer));

        $msg = EarlyExpirationMessage::create($reverseContainer$computationService$item$pool);

        $this->assertSame('@computation_service', $msg->getCallback());
        $this->assertSame($computationService$msg->findCallback($reverseContainer));
    }
}
if ($item->expiry > $endTime = microtime(true)) {
                    $item->newMetadata[CacheItem::METADATA_EXPIRY] = $item->expiry;
                    $item->newMetadata[CacheItem::METADATA_CTIME] = (int) ceil(1000 * ($endTime - $startTime));
                }
            },
            null,
            CacheItem::class
        D;

        $startTime = microtime(true);
        $pool = $message->findPool($this->reverseContainer);
        $callback = $message->findCallback($this->reverseContainer);
        $save = true;
        $value = $callback($item$save);
        $setMetadata($item$startTime);
        $pool->save($item->set($value));
    }
}
Home | Imprint | This part of the site doesn't use cookies.