Is there anyway to atomicly set a value if one does not already exist?
I have tried a couple different things and they don't seem to work for my use case, I have examples if wanted:
CompareAndSwap(key, nil, value) which doesn't seem to work on unset keys.
GetOrSet and GetOrCompute but those don`t seem to be threadsafe.
If there is currently no way to do this would you be open to a PR adding it?
Thanks
Is there anyway to atomicly set a value if one does not already exist?
I have tried a couple different things and they don't seem to work for my use case, I have examples if wanted:
CompareAndSwap(key, nil, value)which doesn't seem to work on unset keys.GetOrSetandGetOrComputebut those don`t seem to be threadsafe.If there is currently no way to do this would you be open to a PR adding it?
Thanks