using System; namespace Umbraco.Web.Routing { /// /// A singly registered object to assign and get the current IRoutesCache provider /// internal class RoutesCache { private static readonly RoutesCache Instance = new RoutesCache(); private static IRoutesCache _provider; /// /// public contructor assigns the DefaultRoutesCache as the default provider /// public RoutesCache() :this(null) { } /// /// Constructor sets a custom provider if specified /// /// internal RoutesCache(IRoutesCache provider) { _provider = provider ?? new DefaultRoutesCache(); } /// /// Set the routes cache provider /// /// public static void SetProvider(IRoutesCache provider) { if (provider == null) throw new ArgumentNullException("provider"); _provider = provider; } /// /// Singleton accessor /// public static RoutesCache Current { get { return Instance; } } /// /// Get the current provider /// /// public IRoutesCache GetProvider() { return _provider; } } }