Open srogovtsev opened 4 months ago
Hi @srogovtsev thanks for your interest in the library.
This use-case makes sense and is something I’ve considered in the past. As far as why I haven’t built it (yet):
I would call this “process-scoped synchronization”.
If this is something you’d be interested in contributing, let me know and I can offer some guidance.
Very useful for monolithic applications that do not want to introduce external components
Consider the following scenario: we have a system that might run in a distributed mode and in a single-node mode. There are routines that require cross-node synchronization, so we use distributed locks. We use DI and
IDistributedLockProvider
to separate ourselves from the implementation details (and use different stores depending on the deployment. But when we deploy the same system in a single-node, we don't need any kind of backing store, and I would assume that the same functionality can be reasonable implemented simply in-memory, based on existing .net synchronization primitives, and just injected instead (e.g., same way asAddDistributedMemoryCache
implements in-memory cache forIDistributedCache
).But I would suppose that this is a very obvious idea, and it's either that I simply missed this implementation, or there's some hidden complexity/issue that I miss, and it would be recommended to use a backing store even on single-node installations.
Will be very glad to get any pointers.