I have a function that I am memoising, which reads information from a file. Specifically, it reads a 7 GB JSON file and only keeps a small part of it. The function takes the file name as an argument, and I'd like to be able to invalidate the cache if the contents of the file change even if the file name is the same (e.g. I want the cache value to depend on file.info(filename). However, it seems that with the current interface there is no way to accomplish this, because the additional formulae provided to memoise in ... cannot refer to the function's arguments. Is there any way to change this, e.g. evaluating the formulae in an environment containing the function's arguments?
I have a function that I am memoising, which reads information from a file. Specifically, it reads a 7 GB JSON file and only keeps a small part of it. The function takes the file name as an argument, and I'd like to be able to invalidate the cache if the contents of the file change even if the file name is the same (e.g. I want the cache value to depend on
file.info(filename)
. However, it seems that with the current interface there is no way to accomplish this, because the additional formulae provided tomemoise
in...
cannot refer to the function's arguments. Is there any way to change this, e.g. evaluating the formulae in an environment containing the function's arguments?