microsoft / FASTER

Fast persistent recoverable log and key-value store + cache, in C# and C++.
https://aka.ms/FASTER
MIT License
6.29k stars 563 forks source link

Implement atomic GetOrAdd/AddOrUpdate equivalency from ConcurrentDictionary<> #873

Closed stealthin closed 9 months ago

stealthin commented 11 months ago

Hello,

Firstable, a huge thanks for this amazing library.

I have a question: I'm using the SpanByteFunctions and I'd like to know if it would be possible to implement a behavior to mimic the atomic operations GetOrAdd and AddOrUpdate.

Would it be feasible, and if so, would you mind sharing a code to override the default implementation from SpanByteFunctions?

Many thanks.

badrishc commented 9 months ago

You can implement any of these using RMW in FASTER. For example, TryAdd is discussed here: https://github.com/microsoft/FASTER/pull/345#issuecomment-701617849