track.plugin.lru(objs, inmem, envname)
track.summary()
; invoke track.summary(times=3, access=3,
size=T, all=T)
to get the full data frame. The names of the objects are in the rownames
of the dataframe.objs
. It will have value TRUE
where the
corresponding object is in memory, and FALSE
otherwise.
.inmem
, with TRUE
values where the corresponding objects
should be kept in memory.
track
contains an experimental feature that allows
users to supply their own plugin functions that specify
cache rules. Currently, the plugin function can specify
whether or not an object will be flushed from memory at the
end of a top-level command.
track.plugin.lru()
implements a simple least-recently-used discard policy.
To use is, supply it to track.options()
:
track.options(cacheKeepFun=track.plugin.lru, save=TRUE)
Here is another example of a very simple cache plugin function: this one keeps in memory variables whose names begin with the letter 'x'.
my.plugin <- function(objs, inmem, envname) { keep <- regexpr("^x", rownames(objs))>0 # browser() # uncomment for debugging & development return(keep) }
To use this plugin function, supply it to track.options()
:
track.options(cacheKeepFun=my.plugin, save=TRUE)