Cache problem in production mode

We have a solution where customer specific content needs to be shown in the product box on the listing page. We searched the internet and found a possible solution (link) which we used as a base.
We created a subscriber to the ProductListingRouteCacheKeyEvent event and added the customer number (when logged in) to the hash key. In dev mode this is working perfect but in the prod mode the boxes are still cached.

Our code:

Blokcitaat
public static function getSubscribedEvents(): array
{
return [
ProductListingResultEvent::class => ‚onProductListingResultEvent‘,
ProductListingRouteCacheKeyEvent::class => ‚addCustomerCachePart‘,
];
}
/**
* @param ProductListingResultEvent $event
* @return void
/
public function onProductListingResultEvent(ProductListingResultEvent $event): void
{
foreach ($event->getResult() as $product) {
if($event->getSalesChannelContext()->getCustomer()) {
$aangemeld = 'Aangemeld: ’ . date(‚Ymd G:i:s‘);
$product->addExtension(‚extraPaginaInfo‘, new ArrayEntity([‚ingelogd‘ => $aangemeld]));
}
else {
$nietAangemeld = 'Niet aangemeld: ’ . date(‚Ymd G:i:s‘);
$product->addExtension(‚extraPaginaInfo‘, new ArrayEntity([‚ingelogd‘ => $nietAangemeld]));
}
}
}
/
*
* @param ProductListingRouteCacheKeyEvent $event
* @return void
*/
public function addCustomerCachePart(ProductListingRouteCacheKeyEvent $event)
{
if($event->getContext()->getCustomer()) {
$customerNumber = $event->getContext()->getCustomer()->getCustomerNumber();
$event->addPart($customerNumber);
}
}

Any help is appreciated.

Hi.

Currently having the same problem. Did you found a solution for this?