Empties the cache that create_grid_polygons_cached() fills, and returns
the number of grids removed.
See also
create_grid_polygons_cached(), which fills the cache.
Other options and caches:
clear_fitted_cache(),
spatialkit-conditions,
spatialkit-options,
spatialkit_quiet()
Examples
library(sf)
bnd <- st_sf(geometry = st_sfc(st_polygon(list(rbind(
c(0, 0), c(100, 0), c(100, 100), c(0, 100), c(0, 0)
))), crs = 32632))
invisible(clear_grid_cache()) # start from an empty cache
g1 <- create_grid_polygons_cached(bnd, target_cells = 9)
g2 <- create_grid_polygons_cached(bnd, target_cells = 9) # cache hit
print(clear_grid_cache()) # 1: the grid cached above
#> [1] 1
print(clear_grid_cache()) # 0: already empty
#> [1] 0