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

Add file-based locking to cache files #34

Open
fluffy-critter opened this issue Nov 5, 2019 · 1 comment
Open

Add file-based locking to cache files #34

fluffy-critter opened this issue Nov 5, 2019 · 1 comment

Comments

@fluffy-critter
Copy link
Contributor

To better support concurrency, add a Cache.lock primitive which would look something like

with cache.lock(prefix, url) as lock:
    previous = lock.get(schema_version)
    # ...
    lock.save(current)

While a lock is held on a file, any other attempt at acquiring that lock should block.

@fluffy-critter
Copy link
Contributor Author

At this point you might wonder why I don’t just move to using SQLite for the backing store. The thing is,

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