question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Move GetAllByUserId to IOnlineClientManager instead of implementing as a static extension

See original GitHub issue

The default implementation of IOnlineClientManager use a ConcurrentDictionary<string, IOnlineClient> to store the relations between userId and connectionId.

It has problem when sites are deploy to two or more servers, or just one server but enable webgarden in iis (has multi process).

So, I wrote a RedisOnlineClientManager to replace OnlineClientManager, but found it may cause performance problem when someone call GetAllByUserId in OnlineClientManagerExtensions through GetAllClients.

Above all, I think It’s a better practice to define GetAllByUserId in IOnlineClientManager, and leave the how-to-query to the real store mechanism (not a ConcurrentDictionary).

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:13 (4 by maintainers)

github_iconTop GitHub Comments

0reactions
jmhinnencommented, Mar 26, 2018

@personball I think I see the issue with using the Cache. It’s the sliding expiration policy cache that may get in the way. I think your implementation is much better than what I was working towards. Never mind on my question above.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Convert Static to Extension Method refactoring | ReSharper ...
Press Ctrl Shift 0R and then choose Convert Static Method to Extension. Right-click and choose Refactor | Convert Static Method to Extension ......
Read more >
Using middleware config from extension methods in ASP. ...
In general, this won't work with extension methods. Extension methods are static and as such can only access other static members. ASP.
Read more >
Extension Methods - C# Programming Guide
The static class Extensions contains extension methods defined for any type that implements IMyInterface . Classes A , B , and C all...
Read more >
Extension methods
Overview; Using extension methods. Static types and dynamic; API conflicts. Implementing extension methods. Unnamed extensions.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found