Creates and manages simple key-value stores. These can use a variety of approaches for storing the data. This package implements the base methods and support for file system, in-memory and DBI-based database stores.
Simple object cacher for R. storr
acts as a very simple key-value store (supporting get
/set
/del
for arbitrary R objects as data). The actual storage can be transient or persistent, local or distributed without changing the interface. To allow for distributed access, data is returned by content rather than simply by key (with a key/content lookup step) so that if another process changes the data, storr
will retrieve the current version.
storr
always goes back to the common storage (database, filesystem, whatever) for the current object to hash mapping, ensuring consistency when using multiple processes. However, when retrieving or writing the data given a hash we can often avoid accessing the underlying storage. This means that repeated lookups happen quickly while still being able to reflect changes elsewhere; time savings can be substantial where large objects are being stored.
From CRAN
install.packages("storr")
or install the development version with
remotes::install_github("richfitz/[email protected]", upgrade = FALSE)
storr
comes with two vignettes:
driver_multistorr
and storr_multistorr
, #67)$check
and $repair
) for detecting some problems with storr repositories. This is a work in progress and is currently only supported for the rds driver.$duplicate
) and filling ($fill
) keys with identical values, without duplicating or reserialising data (#56, requested by @wlandau)storr
s still work when the the working directory changes (#50, #51, @wlandau)mget
/mset
/mset_by_value
added for vectorised get
/set
/set_by_value
operations that reduce the number of roundtrips on some drivers. del
and exists
become vectorised at the same time. This requires extensive change to drivers but is backward compatible for users.$import()
now returns a matrix with columns name
, namespace
indicating what was imported (previously this was just a vector)=
which reduces the number of possily problematic characters. Existing storrs are unaffected (#43)