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

delete vs clear #34

Open
asakusuma opened this issue Jan 20, 2021 · 2 comments
Open

delete vs clear #34

asakusuma opened this issue Jan 20, 2021 · 2 comments

Comments

@asakusuma
Copy link
Contributor

asakusuma commented Jan 20, 2021

Similar to the questions posed in whatwg/storage#88, would it be helpful to have a .clear() method (get rid of contents, but bucket remains) in addition to .delete()? As far as I can tell, this essentially boils down to: "do we want to be able to persist the bucket options/metadata even when the contents are deleted?"

@evanstade
Copy link
Collaborator

This line comes in handy again:

We want applications to be written assuming that each time they attempt to open a bucket, they may be creating the bucket from scratch.

(The reasoning here is that via automatic eviction or manual clear browsing data, the bucket could be deleted at any time and the app must expect that to happen.)

If authors are truly writing their code with this assumption, then they should always be specifying all the metadata about the bucket in the open call. If they do that, then there's little difference between clear and delete (just what's returned by the keys function between clear/delete and the next open). So I vote for no clear method.

@evanstade
Copy link
Collaborator

I guess the other difference would be what happens to the bucket or a storage type handle (such as the caches object) after delete() or clear() is called.

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

2 participants