We've added the method 'IsCachable ()' to the ICacheProvider to help diagnose and test suitability of entities for caching. It can be used in a live application but we expect it to be more likely used during testing. We don't see any problems with exposing this method on the interface as it has no side affects for the entity being tested or for the cache provider being evaluated against. Any exceptions which occur whilst calling this method are caught and not exposed. The complete signature for the method is shown below: bool IsCacheable<T>(T value, ref IEnumerable<Type> failingTypes) where T : class;
The suitability for caching will be returned as the boolean result and any failing types are returned via the ref parameter 'faillingTypes'. Obviously the internal implementation is dependent on the cache provider being used. The method will always return true for the In Memory & Null Cache Providers because neither of these implementation...