@Override
    @Nonnull
    public Set<Node.UniqueIdentifier> findDirectlySubscribedNodes(@Nonnull JID address) {
        log.debug( "Finding all nodes to which {} is subscribed", address );
        final Set<Node.UniqueIdentifier> result = new HashSet<>();
        for ( final Set<Node> nodes : serviceIdToNodesCache.values() ) {
            for ( final Node node : nodes ) {
                if ( node.getSubscriptions().stream().anyMatch( s ->
                        s.isActive() &&
                        (s.getJID().equals(address) || s.getJID().equals(address.asBareJID()) )
                )) {
                    result.add(node.getUniqueIdentifier());
                }
            }
        }
        return result;
    }
Cache that holds all published items (mapped by node ID).
xmppserver/src/main/java/org/jivesoftware/openfire/pubsub/InMemoryPubSubPersistenceProvider.java