-
Notifications
You must be signed in to change notification settings - Fork 295
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 a way to tell if Bytes
is unique
#533
Comments
Seems reasonable enough to me. |
@zyxw59 What about instances created using |
I think in that case it is probably correct to always say that it is not unique (since there always might be other copies) |
I think this can be easily implemented by adding another function to |
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I would like to be able to tell if a
Bytes
object is the unique reference to the underlying data. The usecase is a cache, where I want to be able to evict an object from the cache only if it is not used elsewhere — otherwise, removing it from the cache would not free up any memory, and if the object was requested again later, it would have to be fetched (in my case, thru a network request), and duplicated in memory if the original copy is still around.The text was updated successfully, but these errors were encountered: