// initialize a PublishedContentCache instance with
        // an XmlStore containing the master xml
        // an ICacheProvider that should be at request-level
        // a RoutesCache - need to cleanup that one
        // a preview token string (or null if not previewing)
        public PublishedContentCache(
            XmlStore xmlStore,            // an XmlStore containing the master xml
            IDomainCache domainCache,     // an IDomainCache implementation
            ICacheProvider cacheProvider, // an ICacheProvider that should be at request-level
            IGlobalSettings globalSettings,
            ISiteDomainHelper siteDomainHelper,
            PublishedContentTypeCache contentTypeCache, // a PublishedContentType cache
            RoutesCache routesCache,                    // a RoutesCache
            string previewToken)                        // a preview token string (or null if not previewing)
            : base(previewToken.IsNullOrWhiteSpace() == false)
        {
            _cacheProvider    = cacheProvider;
            _globalSettings   = globalSettings;
            _routesCache      = routesCache; // may be null for unit-testing
            _contentTypeCache = contentTypeCache;
            _domainCache      = domainCache;
            _domainHelper     = new DomainHelper(_domainCache, siteDomainHelper);

            _xmlStore = xmlStore;
            _xml      = _xmlStore.Xml; // capture - because the cache has to remain consistent

            if (previewToken.IsNullOrWhiteSpace() == false)
            {
                _previewContent = new PreviewContent(_xmlStore, previewToken);
            }
        }
        public override string EnterPreview(IUser user, int contentId)
        {
            var previewContent = new PreviewContent(_xmlStore, user.Id);

            previewContent.CreatePreviewSet(contentId, true); // preview branch below that content
            return(previewContent.Token);
            //previewContent.ActivatePreviewCookie();
        }
        public override void ExitPreview(string previewToken)
        {
            if (previewToken.IsNullOrWhiteSpace())
            {
                return;
            }
            var previewContent = new PreviewContent(_xmlStore, previewToken);

            previewContent.ClearPreviewSet();
        }
        public override void RefreshPreview(string previewToken, int contentId)
        {
            if (previewToken.IsNullOrWhiteSpace())
            {
                return;
            }
            var previewContent = new PreviewContent(_xmlStore, previewToken);

            previewContent.CreatePreviewSet(contentId, true); // preview branch below that content
        }