LocalSessionStore implements SessionStore { @Override public void invalidateByKey(String key, String value) { values.values().removeIf(session -> Strings.equals(value, session.values.get(key))); }  @Override Map<String, String> getAndRefresh(String sessionId, String domain, Duration sessionTimeout); @Override void save(String sessionId, String domain, Map<String, String> values, Set<String> changedFields, Duration sessionTimeout); @Override void invalidate(String sessionId, String domain); @Override void invalidateByKey(String key, String value); void cleanup();  }
@Test void invalidateByKey() { localSessionStore.values.put("session1", sessionValue(Instant.now().minus(Duration.ofSeconds(30)), Map.of("key", "v1"))); localSessionStore.values.put("session2", sessionValue(Instant.now().minus(Duration.ofSeconds(30)), Map.of("key", "v1"))); localSessionStore.values.put("session3", sessionValue(Instant.now().minus(Duration.ofSeconds(30)), Map.of("key", "v2"))); localSessionStore.invalidateByKey("key", "v1"); assertThat(localSessionStore.values).containsOnlyKeys("session3"); }