As part of my work on reimagining Volley as a cross-platform library called Akavache.Http, one of the suggestions brought up on Twitter by Todd Berman was that this library was too monolithic and "all or nothing".
I think about this a lot - when you build your own custom, shiny hammer, it's tough to go back to the store-bought one to build something new. However, giving into that impulse can also result in a "kitchen sink" approach of software, ending up with a complex dependency tree or a sprawling framework. As Scott Hanselman would say, the LEGO pieces need to be the right size.
Well, I'm still going to build Akavache.Http on top of Akavache, but I realized that one piece could be more easily shared than the rest, the code to manage concurrency.
Make sure your asynchronous operations show up to work on time
I've released a new Portable Library called Punchclock to solve this problem:
Of course, it's also available on NuGet, and is compatible with all of the Xamarin platforms, as well as .NET 4.5-based Windows apps (this includes WinRT).
What does it do?
Punchclock allows you to issue requests whenever you want, but ensure that you're not overloading limited resources such as a 3G connection, by limiting the number of concurrent requests, but with prioritization. This allows certain important items to "skip the line" and be executed faster, even if they were queued later.
Check it out!