lukecwik commented on a change in pull request #16252:
URL: https://github.com/apache/beam/pull/16252#discussion_r770951807



##########
File path: 
sdks/java/harness/src/test/java/org/apache/beam/fn/harness/CachesTest.java
##########
@@ -109,15 +121,27 @@ public void testNestedSubCaches() {
     childOfChild.remove("keyB");
     assertEquals("childB", child.peek("keyB"));
     assertNull(childOfChild.peek("keyB"));
+  }
+
+  @Test
+  public void testClearableCache() {
+    ClearableCache<String, String> cache = new 
ClearableCache<>(Caches.eternal());
+    testCache(cache);
+  }
 
-    // Test that clearing the middle cache impacts children but not parent
-    parent.put("keyA", "parentA");
-    parent.put("keyB", "parentB");
-    child.clear();
-    assertThat(child.keys(), is(emptyIterable()));
-    assertThat(childOfChild.keys(), is(emptyIterable()));
-    assertEquals("parentA", parent.peek("keyA"));
-    assertEquals("parentB", parent.peek("keyB"));

Review comment:
       The existing implementation to scan all the keys was too slow so I 
didn't want people to rely on it. This way the have to be cognizant about 
having a cache where they take the memory overhead of tracking the keys 
explicitly,
   
   




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to