sasa1977 / con_cache

ets based key/value cache with row level isolated writes and ttl support
MIT License
910 stars 71 forks source link

Identic return for get_or_store #10

Closed essenciary closed 9 years ago

essenciary commented 9 years ago

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).

sasa1977 commented 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?

essenciary commented 9 years ago

I refactored the code to work around it. Let me try to revert it / extract it and I'll get back to you.

essenciary commented 9 years ago

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!