Skip to content

Commit 0d4de4b

Browse files
committed
fix(jcache): Use cache.flush for removeAll() without keys
removeAll() with no args removes all entries, which is semantically equivalent to clear(). Use cache.flush instead of cache.remove. The keyed removeAll(Set) remains cache.remove.
1 parent 038e792 commit 0d4de4b

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

sentry-jcache/src/main/java/io/sentry/jcache/SentryJCacheWrapper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ public void removeAll(final Set<? extends K> keys) {
252252

253253
@Override
254254
public void removeAll() {
255-
final ISpan span = startSpan("cache.remove", null);
255+
final ISpan span = startSpan("cache.flush", null);
256256
if (span == null) {
257257
delegate.removeAll();
258258
return;

sentry-jcache/src/test/kotlin/io/sentry/jcache/SentryJCacheWrapperTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,15 +288,15 @@ class SentryJCacheWrapperTest {
288288
// -- removeAll() --
289289

290290
@Test
291-
fun `removeAll creates cache remove span`() {
291+
fun `removeAll without keys creates cache flush span`() {
292292
val tx = createTransaction()
293293
val wrapper = SentryJCacheWrapper(delegate, scopes)
294294

295295
wrapper.removeAll()
296296

297297
verify(delegate).removeAll()
298298
assertEquals(1, tx.spans.size)
299-
assertEquals("cache.remove", tx.spans.first().operation)
299+
assertEquals("cache.flush", tx.spans.first().operation)
300300
}
301301

302302
// -- clear --

0 commit comments

Comments
 (0)