- Notifications
You must be signed in to change notification settings - Fork417
Writing cache for long running computation#1010
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
Hi, first of all thanks for the great gem! Now I know this is hinted at in the docs but I was looking for examples, the problem is - I'm writing a cache for long running computation based on Concurrent::Map and I want to make sure only single thread runs the computation in case the value is absent (with other threads waiting for result from this single thread), is it possible using just the Concurrent::Map (as far as I can tell it isn't), and if not what primitives are the best/most robust to choose? |
BetaWas this translation helpful?Give feedback.
All reactions
It took me a long while to become familiar with the library 🤗
Concurrent Ruby borrows quite a lot from Java's concurrency primitives. You might start there:https://docs.oracle.com/javase/tutorial/essential/concurrency/atomic.html
Replies: 2 comments 2 replies
-
|
BetaWas this translation helpful?Give feedback.
All reactions
-
Ok, seems like I misunderstood the docs somewhat, is there any place I can read up on the definition of "atomic"? |
BetaWas this translation helpful?Give feedback.
All reactions
-
It took me a long while to become familiar with the library 🤗 Concurrent Ruby borrows quite a lot from Java's concurrency primitives. You might start there:https://docs.oracle.com/javase/tutorial/essential/concurrency/atomic.html |
BetaWas this translation helpful?Give feedback.
All reactions
❤️ 1
-
Ok, this works for me then for now, now gotta figure out why all these concurrent calls in my code... |
BetaWas this translation helpful?Give feedback.