Reputation: 33
I have an ASP.NET application that accesses a class that wraps a Dictionary and may be accessed during page request handling. Akka.NET actor also obtains a reference to that class instance during initialization and may access the class any time.
What's the best way to synchronize access to that Dictionary without breaking Akka.NET's flow? Can using .NET Monitor's break Akka.NET threadpool somehow? I can't change entire application logic to actors and wrap the cache in an actor (yet) so I'd like to hear about (least bad) alternatives.
Upvotes: 2
Views: 288
Reputation: 1075
As long as your in this hybrid scenario. I'd recommend to keep it simple and use a ConcurrentDictionary type to synchronise access.
Upvotes: 2
Reputation: 9473
If you have the opportunity to refactor and have dictionary data served by designated actor, that will be the best approach IMHO.
Upvotes: 0