Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up cached data linked to old file modtimes #27

Open
dimo414 opened this issue Apr 2, 2023 · 1 comment
Open

Clean up cached data linked to old file modtimes #27

dimo414 opened this issue Apr 2, 2023 · 1 comment

Comments

@dimo414
Copy link
Owner

dimo414 commented Apr 2, 2023

Now that --modtime is supported it's possible for a cached invocation to become functionally unreachable1 but remain in the cache for an extended period of time. For example:

bkt --ttl=1d --modtime=.git/FETCH_HEAD -- git status

Any cached status will become unreachable whenever FETCH_HEAD is updated (i.e. after git fetch / git pull) but presently bkt can't actually clean up the data until the TTL expires. In principle bkt could clean up all existing cached data linked to a given file whenever its modtime changes.

Furthermore, if this functionality is added such commands could be allowed to not set a TTL at all (if they want) and simply rely on modtime invalidation.

This would be a somewhat sizable refactoring of the Bkt and Cache APIs, but it's probably worth the effort.

Footnotes

  1. yes a file could theoretically be set to a prior modtime, either manually or after a clock change, but this is uncommon and a cache miss in such circumstances is probably acceptable.

@dimo414
Copy link
Owner Author

dimo414 commented Oct 31, 2023

Anyone interested in this feature is invited to weigh in on #48 as well

dimo414 added a commit that referenced this issue Jan 20, 2024
This is a breaking change but the default behavior is arbitrary and it's
unlikely most users actually need or want this TTL. Furthermore, making
this change will enable introducing other expiration mechanisms in the
future. More details in #48 and #27.
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

No branches or pull requests

1 participant