public SqlContentTreeProvider(string connectionString, Uri invalidateCacheUri)
 {
     ContentChanged += (sender, e) => { };
     this.connectionString = connectionString;
     cacheEndpoint = new InvalidateCacheEndpoint(invalidateCacheUri);
     cacheEndpoint.CacheInvalidated += InvalidateCache;
     cacheEndpoint.Open();
 }
 public MongoContentTreeProvider(string connectionString, string collectionName, Uri invalidateCacheUri)
 {
     ContentChanged += (sender, e) => { };
     var builder = new MongoUrlBuilder(connectionString);
     this.collectionName = collectionName;
     databaseName = builder.DatabaseName;
     mongoServer = MongoServer.Create(connectionString);
     cacheEndpoint = new InvalidateCacheEndpoint(invalidateCacheUri);
     cacheEndpoint.CacheInvalidated += InvalidateCache;
     cacheEndpoint.Open();
 }
        public override void Spin(IRotorContext context)
        {
            if (string.IsNullOrWhiteSpace(ConfigurationManager.AppSettings["Bennington.ContentTree.EnableOutputCacheInvalidation"]))
                return;

            var invalidateCacheUri = new Uri(string.Format("net.pipe://localhost/caching/{0}/content_tree", ConfigurationManager.AppSettings["Bennington.ContentTree.OutputCaching.CacheKey"] ?? "Bennington.ContentTree.CacheKey"));
            cacheEndpoint = new InvalidateCacheEndpoint(invalidateCacheUri);
            cacheEndpoint.CacheInvalidated += InvalidateCache;

            try
            {
                cacheEndpoint.Open();
            }
            catch (AddressAlreadyInUseException ex)
            {
                cacheEndpoint.Dispose();
                cacheEndpoint.Open();
            }
        }