### Question:
CacheDirectory extends Directory implements DirectoryDecorator, LastModified { public void close() throws IOException { _cache.releaseDirectory(this); _internal.close(); } CacheDirectory(String table, String shard, Directory directory, Cache cache,
      Set<String> tableBlockCacheFileTypes); String getShard(); String getTable(); IndexInput openInput(String name, IOContext context); IndexOutput createOutput(String name, IOContext context); void deleteFile(String name); String[] listAll(); boolean fileExists(String name); long fileLength(String name); void sync(Collection<String> names); Lock makeLock(String name); void clearLock(String name); void close(); void setLockFactory(LockFactory lockFactory); LockFactory getLockFactory(); String getLockID(); String toString(); void copy(Directory to, String src, String dest, IOContext context); IndexInputSlicer createSlicer(String name, IOContext context); String getDirectoryName(); @Override long getFileModified(String name); @Override Directory getOriginalDirectory();  }### Answer:
@Test public void test3() throws IOException, InterruptedException { IndexWriterConfig conf = new IndexWriterConfig(Version.LUCENE_43, new KeywordAnalyzer()); IndexWriter writer = new IndexWriter(_cacheDirectory, conf); int docs = 100000; for (int i = 0; i < docs; i++) { if (i % 500 == 0) { System.out.println(i); } writer.addDocument(newDoc()); } writer.close(); System.out.println("done writing"); DirectoryReader reader = DirectoryReader.open(_cacheDirectory); System.out.println("done opening"); assertEquals(docs, reader.numDocs()); Document document = reader.document(0); System.out.println("done fetching"); System.out.println(document); IndexSearcher searcher = new IndexSearcher(reader); TopDocs topDocs = searcher.search(new TermQuery(new Term("test", "test")), 10); System.out.println("done searching"); assertEquals(docs, topDocs.totalHits); reader.close(); }