setup.mcache {mvbutils} | R Documentation |
Cacheing objects for lazy-load access
Description
Manually setup existing reference objects– rarely used explicitly.
Usage
setup.mcache( envir, fpath, refs)
Arguments
envir |
environment or position on the search path. |
fpath |
directory where "obj*.rda" files live. |
refs |
which objects to handle– all names in the |
Details
Creates an active binding in envir
for each element in refs
. The active binding for an object myobj
will be a function which keeps the real data in its own environment, reading and writing it as required. Writing a new value will give attr( envir, "mcache")[ "myobj"]
a negative sign. This signals that the "obj*.rda" file needs updating, and the next Save
(or move
or cd
) command will do so. [The "*" is the absolute value of attr( envir, "mcache")[ "myobj"]
.] One wrinkle is that the "real data" is initially a promise
created by delayedAssign
, which will fetch the data from disk the first time it is needed.
Author(s)
Mark Bravington
See Also
mlazy
, makeActiveBinding
, delayedAssign