### Question:
CachePyramidResource extends AbstractGridResource implements MultiResolutionResource, GridCoverageResource { @Override public MultiResolutionModel createModel(MultiResolutionModel template) throws DataStoreException { synchronized (cacheMap) { final MultiResolutionModel newParentPyramid = parent.createModel(template); final CacheTileMatrixSet cached = new CacheTileMatrixSet((TileMatrixSet) newParentPyramid); cacheMap.put(cached.getIdentifier(), cached); return cached; } } CachePyramidResource(T parent, int initialCapacity, final long costLimit, final boolean soft);  CachePyramidResource(T parent, int initialCapacity, final long costLimit, final boolean soft, boolean noblocking); void setIdentifier(GenericName identifier); @Override Optional<GenericName> getIdentifier(); @Override Collection<TileMatrixSet> getModels(); @Override List<SampleDimension> getSampleDimensions(); @Override GridGeometry getGridGeometry(); @Override MultiResolutionModel createModel(MultiResolutionModel template); @Override void removeModel(String identifier); @Override GridCoverage read(GridGeometry domain, int... range); @Override void clearCache();  }### Answer:
@Test public void testUpdate() throws DataStoreException { final InMemoryPyramidResource parent = new InMemoryPyramidResource(Names.createLocalName(null, null, "test")); final CachePyramidResource r = new CachePyramidResource(parent, 30, 60, true); final List<StoreEvent> events = new ArrayList<>(); r.addListener(StoreEvent.class, new StoreListener<StoreEvent>() { @Override public void eventOccured(StoreEvent event) { events.add(event); } }); final TileMatrixSet tileMatrixSet = (TileMatrixSet) parent.createModel(TileMatrices.createWorldWGS84Template(1)); Assert.assertEquals(1, events.size()); events.clear(); final TileMatrix tileMatrix = tileMatrixSet.getTileMatrices().iterator().next(); final ImageTile it = new DefaultImageTile(new BufferedImage(256, 256, BufferedImage.TYPE_INT_ARGB), 0, 0); tileMatrix.writeTiles(Stream.of(it), null); Assert.assertEquals(1, events.size()); events.clear(); final ImageTile it2 = new DefaultImageTile(new BufferedImage(256, 256, BufferedImage.TYPE_INT_ARGB), 0, 0); tileMatrix.writeTiles(Stream.of(it2), null); Assert.assertEquals(1, events.size()); events.clear(); }