Implementing a Service that caches requests and then executes on an interval.
Any examples I could look at for something like this?
I have some objects that when they are created need to refresh some data from a service endpoint that has strict requests per minute. However I can batch a set of objects and request data for many of them only using one request.
but have that service queue all requests, waiting 5 seconds, batching those requests to the service endpoint, parsing the return data, and then returning the relevant data to the thread, how would I do that?
I have something working right now but it fails some of the time.
My current implementation is using TimedQueue and a ManualResetEvent.
The TimedQueue enqueues objects and then every 5 seconds raises an event to batch the service request and populate a variable. Meanwhile the consumer is waiting with manualResetEvent.WaitOne(), which is set and then immediately reset after the batched service request is completed.
Anyway, any examples of something like this I could look at?