/// <summary>
        /// Initializes a new instance of the <see cref="GleanerContext"/> class.
        /// </summary>
        /// <param name="serviceContext">
        /// The service context.
        /// </param>
        /// <param name="cache">
        /// The cache.
        /// </param>
        internal GleanerContext(ServiceContext serviceContext, CacheHelper cache)
        {
            Mandate.ParameterNotNull(serviceContext, "serviceContext");
            Mandate.ParameterNotNull(cache, "cache");

            _services = serviceContext;
            Cache = cache;
        }
        /// <summary>
        /// The initialize.
        /// </summary>
        /// <returns>
        /// The <see cref="IBootManager"/>.
        /// </returns>
        /// <exception cref="InvalidOperationException">
        /// Throws an exception if Gleaner is already initialized
        /// </exception>
        public virtual void Initialize()
        {
            if (IsInitialized)
            {
                throw new InvalidOperationException("The Gleaner core boot manager has already been initialized");
            }

            _timer = DisposableTimer.DebugDuration<CoreBootManager>("Gleaner starting", "Gleaner startup complete");

            // create the service context for the GleanerAppContext
            var serviceContext = new ServiceContext();

            var cache = ApplicationContext.Current == null
                ? new CacheHelper(
                    new ObjectCacheRuntimeCacheProvider(),
                    new StaticCacheProvider(),
                    new NullCacheProvider())
                : ApplicationContext.Current.ApplicationCache;

            CreateGleanerContext(serviceContext, cache);

            IsInitialized = true;
        }
 /// <summary>
 /// Creates the GleanerPluginContext (singleton)
 /// </summary>
 /// <param name="serviceContext">The sevice context</param>
 /// <param name="cache">The cache helper</param>
 /// <remarks>
 /// Since we load fire our boot manager after Umbraco fires its "started" even, Gleaner gets the benefit
 /// of allowing Umbraco to manage the various caching providers via the Umbraco CoreBootManager or WebBootManager
 /// depending on the context.
 /// </remarks>
 protected void CreateGleanerContext(ServiceContext serviceContext, CacheHelper cache)
 {
     _gleanerContext = GleanerContext.Current = new GleanerContext(serviceContext, cache);
 }