So recently I had a chance to work on a Xamarin app that deals with Cache Invalidation (yep, one of the three most difficult things in computer science :)). For cacheing I used Akavache and mostly its famous
GetAndFetchLatest method. And I noticed that it would be very cool to be able to inspect the local cache while doing manual testing to make sure cache is being invalidated as expected. It wouldn’t be too hard to do that manually but I decided to make a reusable solution. So I wrote two nuget packages AkavacheExplorer.iOS and AkavacheExplorer.Droid that allows us to inspect local Acavache store. We just have to include these packages in platform-specific Xamarin projects and present explorer’s UIViewController/Activity on each platform.
Sample for iOS:
using AkavacheExplorer.iOS; ... PresentViewController(Explorer.GetNavigationController(), true, null);
Sample for Android:
using AkavacheExplorer.Droid; ... StartActivity(typeof(ExplorerActivity));
And a list of all keys will be presented. When key is selected data will be serialized and JSON will be presented. As simple as that!
Explorer does not support images or binary data yet. But the source code is available on my github page so feel free to adapt it to your needs.
I just released versions 1.1.0 of these packages to nuget.org. They add an ability to view cached content not only as json but as raw text and image as well. Feel free to try them out! Any feedback is also welcome.