C# - Keep real time count of endpoint calls

Viewed 149

I have a endpoint like so in my code:

[HttpPost]
public ActionResult<Result> myEndpoint() 
{
   ...
}

The code will be hosted on multiple servers and I need to keep a real time count of how many times it is being called across all servers.

Originally I figured a distributed cache with Redis might be useful, but I could run into issues if multiple servers grabbed the same number from the cache and manipulated it at the same time. The numbers would be off if that happened.

Is there a good way to keep a real time count for any given endpoint?

0 Answers
Related