public function onFlush(\Doctrine\ORM\Event\OnFlushEventArgs $eventArgs) {
        $reCacheEntities = [];
        
        $em = $eventArgs->getEntityManager();
        $uow = $em->getUnitOfWork();
        
        foreach ($uow->getScheduledEntityInsertions() as $entity) {
            $reCacheEntities[get_class($entity)] = true;
        }

        foreach ($uow->getScheduledEntityUpdates() as $entity) {
            $reCacheEntities[get_class($entity)] = true;
        }

        foreach ($uow->getScheduledEntityDeletions() as $entity) {
            $reCacheEntities[get_class($entity)] = true;
        }

        foreach ($uow->getScheduledCollectionDeletions() as $col) {
            $reCacheEntities[get_class($entity)] = true;
        }

        foreach ($uow->getScheduledCollectionUpdates() as $col) {
            $reCacheEntities[get_class($entity)] = true;
        }
        
        foreach ($reCacheEntities as $entityNamespace => $flag) {
            $this->recache($entityNamespace);
        }
    }