Fast but transient environment driver. This driver saves objects in a local R environment, without serialisation. This makes lookup fast but it cannot be saved across sesssions. The environment storr can be made persistent by saving it out as a file storr though.

storr_environment(envir = NULL, hash_algorithm = NULL,
  default_namespace = "objects")

driver_environment(envir = NULL, hash_algorithm = NULL)

Arguments

envir

The environment to point the storr at. The default creates an new empty environment which is generally the right choice. However, if you want multiple environment storrs pointing at the same environment then pass the envir argument along.

hash_algorithm

Name of the hash algorithm to use. Possible values are "md5", "sha1", and others supported by digest. If not given, then we will default to "md5".

default_namespace

Default namespace (see storr).

Examples

# Create an environment and stick some random numbers into it: st <- storr_environment() st$set("foo", runif(10)) st$get("foo")
#> [1] 0.28989230 0.67838043 0.73531960 0.19595673 0.98053967 0.74152153 #> [7] 0.05144628 0.53021246 0.69582388 0.68855600
# To make this environment persistent we can save it to disk: path <- tempfile() st2 <- st$archive_export(path) # st2 is now a storr_rds (see ?storr_rds), and will persist across # sessions. # or export to a new list: lis <- st$export(list()) lis
#> $foo #> [1] 0.28989230 0.67838043 0.73531960 0.19595673 0.98053967 0.74152153 #> [7] 0.05144628 0.53021246 0.69582388 0.68855600 #>