Also, I use "after" very often. If I run a line that has a Cache, and it is pulling in a cached copy that I don't want, then:
clearCache("/path/to/repo", after = Sys.time() - 20)
That will remove all items in the Cache database that were "hit" in the last 20 seconds.
But, @AlexChubaty is sort of correct... you *can* use arguments if you convert them to their hash manually using .robustDigest(arg) to find its hash value.
library(reproducible)
a <- Cache(rnorm, 4000)
b <- Cache(rnorm, 5000)
showCache()
hashVal <- .robustDigest(5000) # get only the one that had 5000 as its argument value
showCache(userTags = hashVal) # shows the cached elements that have 5000 as an argument
clearCache(userTags = hashVal) # deletes it
showCache() # only the one with 4000 is left
Other ways to find cached elements: The function name (e.g., shapefile), time stamp (including both write and read to Cache), also, object.size has been useful when I needed to detect failed function calls (the success would have been a large raster object, and the failed ones were <1000 bytes).