@@ -123,6 +123,19 @@ Cache <- R6::R6Class(
123123 },
124124
125125 # ' @description Prune the cache
126+ # '
127+ # ' Delete cached objects that match certain criteria. `max_files` and
128+ # ' `max_size` deletes the oldest cached objects first; however, this is
129+ # ' dependent on accuracy of the file modification timestamps on your system.
130+ # ' For example, ext3 only supports second-accuracy, and some windows
131+ # ' version only support timestamps at a resolution of two seconds.
132+ # '
133+ # ' If two files have the same timestamp, they are deleted in the lexical
134+ # ' sort order of their key. This means that by using a function that
135+ # ' generates lexically sortable keys as `hashfun` (such as
136+ # ' [ulid::generate()]) you can enforce the correct deletion order. There
137+ # ' is no such workaround if you use a real hash function.
138+ # '
126139 # ' @param max_files,max_size,max_age see section Active Bindings.
127140 # ' @param now a `POSIXct` datetime scalar. The current time (for max_age)
128141 prune = function (
@@ -301,13 +314,6 @@ Cache <- R6::R6Class(
301314 # ' a storage key must be supplied manually in `cache$push()`. If a new
302315 # ' object is added with the same key as an existing object, the existing
303316 # ' object will be overwritten without warning.
304- # '
305- # ' *Note:*
306- # ' If hashfun is something that generates a unique ID instead of a hash,
307- # ' it is recommended to use a lexically sortable unique ID (such as ulid).
308- # ' This ensures that `$prune()` and co will delete objects in order of
309- # ' their creation at sub-second accuracy. This is only an issue on
310- # ' file-systems with low precission timestamp such as ext3 or FAT.
311317 hashfun = function (fun ){
312318 if (missing(fun )){
313319 res <- get(" .hashfun" , envir = private )
0 commit comments