@Override public Object visitRemoveCommand(InvocationContext ctx, RemoveCommand command) throws Throwable { Object retval = invokeNextInterceptor(ctx, command); Object key = command.getKey(); if (!skip(ctx, key, command) && !ctx.isInTxScope() && command.isSuccessful()) { boolean resp = store.remove(key); log.tracef("Removed entry under key %s and got response %s from CacheStore", key, resp); } return retval; }
@Override public Object visitRemoveCommand(InvocationContext ctx, RemoveCommand command) throws Throwable { // remove the object out of the cache first. Object valueRemoved = invokeNextInterceptor(ctx, command); if (command.isSuccessful() && !command.isNonExistent() && shouldModifyIndexes(ctx)) { Object value = extractValue(valueRemoved); if (updateKnownTypesIfNeeded(value)) { removeFromIndexes(value, extractValue(command.getKey())); } } return valueRemoved; }
/** * Indexing management of a RemoveCommand * * @param command the visited RemoveCommand * @param ctx the InvocationContext of the RemoveCommand * @param valueRemoved the value before the removal * @param transactionContext Optional for lazy initialization, or reuse an existing context. */ private void processRemoveCommand( final RemoveCommand command, final InvocationContext ctx, final Object valueRemoved, TransactionContext transactionContext) { if (command.isSuccessful() && !command.isNonExistent() && shouldModifyIndexes(command, ctx)) { final Object value = extractValue(valueRemoved); if (updateKnownTypesIfNeeded(value)) { transactionContext = transactionContext == null ? makeTransactionalEventContext() : transactionContext; removeFromIndexes(value, extractValue(command.getKey()), transactionContext); } } }