Closed essenciary closed 9 years ago
I just looked into the code, and as far as I can tell, get_or_store
should always return the value. This is confirmed by typespec of the function and the tests. Can you show a code snippet where this doesn't happen?
I refactored the code to work around it. Let me try to revert it / extract it and I'll get back to you.
Can't replicate it anymore so probably my code was doing something funky. Thanks for your support - I'll close this and reopen if I'll be able to reproduce it down the road. Cheers!
The get_or_store function can not be properly used due to the fact that it returns different values whether it gets or stores.
If I'm missing the intended use case, please provide an example. Otherwise the correct implementation should be to always return the value, either after get, either after storing (instead of :ok).