protected function getCacheIdentityListeners()
    {
        if (null === $this->cacheIdentityListeners) {
            $this->cacheIdentityListeners = [];
            $listeners = $this->dispatcher->getListeners(SecurityIdentityEvents::RETRIEVAL_ADD);

            foreach ($listeners as $listener) {
                $listener = \is_array($listener) && \count($listener) > 1 ? $listener[0] : $listener;

                if ($listener instanceof CacheSecurityIdentityListenerInterface) {
                    $this->cacheIdentityListeners[] = $listener;
                }
            }
        }

        return $this->cacheIdentityListeners;
    }