Async Remove #546
sunmisc
started this conversation in
Show and tell
Replies: 1 comment 4 replies
-
Hi @JolyJDIA, Unfortunately, I am not sure what your question is to respond to. Generally map remove operations are very fast and an asynchronous delete is unnecessary. This won't hold if you perform long running map computations as it must synchronize, but in an |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello, I want to discuss a fully asynchronous cache with you. I apologize immediately,
I do not have a good knowledge of English (because I am not a native speaker of this language)
I also want to apologize, because my language will not be like an academic one,
but will be comparable to the language of an ordinary schoolboy (which it is)
I want to implement an asynchronous delete method from the map(yes by Completablefuture)
What I propose and what I have implemented,
let's take a ConcurrentHashMap and store the-Node values. Each node will have at least 2 fields-a boolean flag and CompletableFuture next
the flag is required for emergency braking load or unload, and then a stack of action
as soon as I want to delete, I add to the stack CompletableFuture that will decide whether a value is removed from the card or not
(Boolean value helps you determine whether to add/delete the following action or not.
For example, true-deleted,
false - added
you can use this result to determine if I need to add or remove, or if the last action has already done it for me.
here is an example of the pseudocode of the append method:
//remove method
as you can see, this requires minimal blocking costs(you can even CAS probably)
It should look like a pipe with gateways
If you need my full implementation let me know
I hope I didn't show that I'm a complete idiot, thank you
Beta Was this translation helpful? Give feedback.
All reactions