Skip to content

Conversation

@dnicolodi
Copy link
Collaborator

@dnicolodi dnicolodi commented Feb 13, 2021

This is still missing documentation, but I know that @blais is eagerly waiting for something like this, thus this early PR to review. There are example of usage in the added tests. By default the cache is keyed on the filename and expired on the file modification time. However, this can be overwritten with the key argument to the cache decorator. In the tests there is an example for using the input file SHA1 digest. All arguments to the decorated function are always part of the cache key.

Which directory to use for the cache on WIndows? On Unix-like systems ~/.cache/beangulp/ is a good choice, but I don't have idea what would be the equivalent on Windows. Also, what should be the behavior when the cache directory does not exist? The implementation proposed simply raises FileNotFoundError exception. Another possibility, would to silently disable the cache.

@dnicolodi
Copy link
Collaborator Author

dnicolodi commented Feb 13, 2021

I think that ignoring FileNotFoundErrors when the cache is being written is the best way forward and I implemented it. I don't think writing possibly sensitive data to disk without the user being fully aware is a good idea. In this way the user needs to opt in to the caching creating the cache directory ~/.cache/beangulp/.

@dnicolodi dnicolodi force-pushed the cache branch 9 times, most recently from 7e06370 to 463a8d5 Compare February 14, 2021 22:27
@blais blais merged commit 22debe1 into beancount:master Feb 15, 2021
@dnicolodi dnicolodi deleted the cache branch February 16, 2021 08:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants