@Override
    public void updateAffiliation(Node node, NodeAffiliate affiliate)
    {
        log.debug( "Updating node affiliation for {} (type: {}) on node {}", affiliate.getJID(), affiliate.getAffiliation(), node.getUniqueIdentifier() );
        final List<NodeOperation> operations = nodesToProcess.computeIfAbsent( node.getUniqueIdentifier(), id -> new ArrayList<>() );
        // This affiliation update can replace any pending updates of the same affiliate (since the last create/delete of the node or affiliation change of this affiliate to the node).
        final ListIterator<NodeOperation> iter = operations.listIterator( operations.size() );
        while ( iter.hasPrevious() ) {
            final NodeOperation op = iter.previous();
            if ( op.action.equals( NodeOperation.Action.UPDATE_AFFILIATION ) ) {
                if ( affiliate.getJID().equals( op.affiliate.getJID() ) ) {
                    iter.remove(); // This is replaced by the update that's being added.
                }
            } else {
                break; // Operations that precede anything other than the last operations that are UPDATE_AFFILIATE shouldn't be replaced.
            }
        }

        final NodeOperation operation = NodeOperation.updateAffiliation( node, affiliate );
        operations.add( operation );
    }
Cache for recently accessed published items.
xmppserver/src/main/java/org/jivesoftware/openfire/pubsub/CachingPubsubPersistenceProvider.java