@Override
    public void afterCreate(final Region region) {
      if (region.getName().contains(".files") || region.getName().contains(".chunks")) {
        region.getAttributesMutator().addCacheListener(new CacheListenerAdapter() {
          @Override
          public void afterCreate(final EntryEvent event) {
            beforeWrite.accept(event.getKey());
          }

          @Override
          public void afterDestroy(final EntryEvent event) {
            beforeWrite.accept(event.getKey());
          }

          @Override
          public void afterInvalidate(final EntryEvent event) {
            beforeWrite.accept(event.getKey());
          }

          @Override
          public void afterUpdate(final EntryEvent event) {
            beforeWrite.accept(event.getKey());
          }
        });
      }

    }
Allows spying on operations that happen to an the regions underlying a lucene index.
geode-lucene/geode-lucene-test/src/main/java/org/apache/geode/cache/lucene/test/IndexRegionSpy.java