Several utility functions for caching workflow data. The most important function is clearCache; other
functions are primarily for internal use.
Usage
makeHash(..., checkDT = TRUE)
makeFileHash(..., length = Inf)
loadCacheData(category, hashes, dbArg = NULL, simplify = TRUE, fixDTs = TRUE)
saveCacheData(category, data, hash, dbArg = NULL)
clearCache(what = NULL, file = NULL, vacuum = TRUE)Arguments
- ...
Arguments/objects to be used for hashing.
- checkDT
logical, set toTRUEwith (alistwith)data.tables to ensure reproducible hashing. Otherwise can be set toFALSEto improve performance.- length
Maximum file length to hash. Passed to
digest.- category
The category of the object to be cached.
- hashes
A
characterwith one more hashes (e.g. obtained withmakeHash) of the objects to be loaded.- dbArg
Alternative connection to database. Default is
NULLand uses the cache options as defined by patRoon.cache.fileName. Mainly used internally to improve performance.- simplify
If
TRUEandlength(hashes)==1then the returned data is returned directly, otherwise the data is in alist.- fixDTs
Should be
TRUEif cached data consists of (nested)data.tables. Otherwise can beFALSEto speed up loading.- data
The object to be cached.
- hash
The hash string of the object to be cached (e.g. obtained with
makeHash).- what
This argument describes what should be done. When
what = NULLthis function will list which tables are present along with an indication of their size (database rows). Ifwhat = "all"then the complete file will be removed. Otherwise,whatshould be a character string (a regular expression) that is used to match the table names that should be removed.- file
The cache file. If
NULLthen the value of thepatRoon.cache.fileNameoption is used.- vacuum
If
TRUEthen theVACUUMoperation will be run on the cache database to reduce the file size. Setting this toFALSEmight be handy to avoid long processing times on large cache databases.
Details
makeHash Make a hash string of given arguments.
makeFileHash Generates a hash from the contents of one or more files.
loadCacheData Loads cached data from a database.
saveCacheData caches data in a database.
clearCache will either remove one or more tables within the cache sqlite database or simply
wipe the whole cache file. Removing tables will VACUUM the database (unless vacuum=FALSE), which may
take some time for large cache files.