I have an abstract class called HttpHelper
it has basic methods like, GET, POST, PATCH, PUT
What I need to achieve is this:
Store the url, time & date
in the database each time the function is called GET, POST, PATCH, PUT
I don't want to store directly to the database each time the functions are called (that would be slow) but to put it somewhere (like a static queue-memory-cache) which must be faster and non blocking, and have a background long running process that will look into this cache-storage-like which will then store the values in the database.
I have no clear idea how to do this but the main purpose of doing so is to take the count of each calls per hour or day, by domain, resource and url query.
I'm thinking if I could do the following:
- Create a static class which uses
ConcurrentQueue<T>
to store data and call that class in each function insideHttpHelper
class - Create a background task similar to this: Asp.Net core long running/background task
- Or use
Hangfire
, but that might be too much for simple task
Or is there a built-in method for this in .netcore?