### Question:
GuavaGraphCache implements GraphCache<Id, M> { @Override public void evict(Id docId) { cache.invalidate(docId); } GuavaGraphCache(VersionStore<Id, M> versionStore,
                           CacheBuilder<Object, Object> cacheBuilder); @SuppressWarnings("unchecked")  GuavaGraphCache(VersionStore<Id, M> versionStore,
                           CacheBuilder<Object, Object> cacheBuilder,
                           GraphOptions<Id, M> graphOptions); static Function<VersionStore<Id, M>, GraphCache<Id, M>> guavaCacheBuilder(CacheBuilder<Object, Object> cacheBuilder); static Function<VersionStore<Id, M>, GraphCache<Id, M>> guavaCacheBuilder(CacheBuilder<Object, Object> cacheBuilder,
                                                                                             GraphOptions<Id, M> graphOptions); @Override ObjectVersionGraph<M> load(Id docId); @Override void refresh(Id docId); @Override void evict(Id docId); @Override void evict(Iterator<Id> docIds); @Override void evictAll();  }### Answer:
@Test public void compact_keep_heads_and_one_newest() { ObjectVersionGraph<String> graph = ObjectVersionGraph.init(); GuavaGraphCache<String, String> cache = newRefreshingCache(1, keepHeadsAndNewest(1, 2)); final String docId = randomUUID().toString(); final Revision v1 = new Revision(1, NODE), v2 = new Revision(2, NODE), v3 = new Revision(3, NODE), v4 = new Revision(4, NODE), v5 = new Revision(5, NODE), v6 = new Revision(6, NODE), v7 = new Revision(7, NODE); graph = graph.commit(ObjectVersion.<String>builder(v1).build()); documentStore.append(docId, graph.getTip()); graph = graph.commit(ObjectVersion.<String>builder(v2).parents(v1).build()); documentStore.append(docId, graph.getTip()); assertCacheContains(cache, docId, v1, v2); graph = graph.commit(ObjectVersion.<String>builder(v3).parents(v2).build()); documentStore.append(docId, graph.getTip()); assertCacheContains(cache, docId, v2, v3); graph = graph.commit(ObjectVersion.<String>builder(v4).parents(v2).build()); documentStore.append(docId, graph.getTip()); graph = graph.commit(ObjectVersion.<String>builder(v5).parents(v3).build()); documentStore.append(docId, graph.getTip()); assertCacheContains(cache, docId, v2, v3, v4, v5); graph = graph.commit(ObjectVersion.<String>builder(v6).parents(v5).build()); documentStore.append(docId, graph.getTip()); assertCacheContains(cache, docId, v2, v4, v5, v6); graph = graph.commit(ObjectVersion.<String>builder(v7).parents(v6, v4).build()); documentStore.append(docId, graph.getTip()); documentStore.publish(); transactionTemplate.execute(status -> { documentStore.updateBatch(docId) .optimize(documentStore.getOptimizedGraph(docId), v -> v.revision.equals(v7)) .execute(); return null; }); assertCacheContains(cache, docId, v6, v7); cache.evict(docId); assertCacheContains(cache, docId, v7); }