@NotNull public Set<String> removeOptimisticUpdates(@NotNull final UUID mutationId) { checkNotNull(mutationId, "mutationId == null"); Set<String> changedCacheKeys = new HashSet<>(); Set<String> removedKeys = new HashSet<>(); Map<String, RecordJournal> recordJournals = lruCache.asMap(); for (Map.Entry<String, RecordJournal> entry : recordJournals.entrySet()) { String cacheKey = entry.getKey(); RecordJournal journal = entry.getValue(); changedCacheKeys.addAll(journal.revert(mutationId)); if (journal.history.isEmpty()) { removedKeys.add(cacheKey); } } lruCache.invalidateAll(removedKeys); return changedCacheKeys; }
@Nonnull public Set<String> removeOptimisticUpdates(@Nonnull final UUID mutationId) { checkNotNull(mutationId, "mutationId == null"); Set<String> changedCacheKeys = new HashSet<>(); Set<String> removedKeys = new HashSet<>(); Map<String, RecordJournal> recordJournals = lruCache.asMap(); for (Map.Entry<String, RecordJournal> entry : recordJournals.entrySet()) { String cacheKey = entry.getKey(); RecordJournal journal = entry.getValue(); changedCacheKeys.addAll(journal.revert(mutationId)); if (journal.history.isEmpty()) { removedKeys.add(cacheKey); } } lruCache.invalidateAll(removedKeys); return changedCacheKeys; }
@Nonnull public Set<String> removeOptimisticUpdates(@Nonnull final UUID mutationId) { checkNotNull(mutationId, "mutationId == null"); Set<String> changedCacheKeys = new HashSet<>(); Set<String> removedKeys = new HashSet<>(); Map<String, RecordJournal> recordJournals = lruCache.asMap(); for (Map.Entry<String, RecordJournal> entry : recordJournals.entrySet()) { String cacheKey = entry.getKey(); RecordJournal journal = entry.getValue(); changedCacheKeys.addAll(journal.revert(mutationId)); if (journal.history.isEmpty()) { removedKeys.add(cacheKey); } } lruCache.invalidateAll(removedKeys); return changedCacheKeys; }