clear() removes keys one by one, which is slower than it could be for RDS storrs.
|
invisible(length(vlapply(self$list(namespace), self$del, namespace))) |
library(storr)
init_storr <- function() {
s <- storr_rds(tempfile())
keys <- as.character(seq_len(1e4))
values <- rep(TRUE, length(keys))
s$mset(keys, values)
s
}
s <- init_storr()
system.time(s$clear())
#> user system elapsed
#> 0.244 0.866 1.111
s <- init_storr()
system.time(unlink(file.path(s$path, "keys", s$default_namespace), recursive = TRUE))
#> user system elapsed
#> 0 0 0
Created on 2020-03-11 by the reprex package (v0.3.0)
@richfitz, would you be open to driver-specific clear() methods so we can do whatever is fastest for the situation?
clear()removes keys one by one, which is slower than it could be for RDSstorrs.storr/R/storr.R
Line 207 in 0c64f1e
Created on 2020-03-11 by the reprex package (v0.3.0)
@richfitz, would you be open to driver-specific
clear()methods so we can do whatever is fastest for the situation?