public AzureBlobCache(IAzureManager azureManager, bool enabled)
        {
            Assert.ArgumentNotNull(azureManager, nameof(azureManager));

            this.azureManager = azureManager;
            this.Enabled      = enabled;
        }
示例#2
0
        public SerializationBlobStorageTree(
            string name,
            string globalRootItemPath,
            string databaseName,
            string physicalRootPath,
            ISerializationFormatter formatter,
            string connectionString,
            string containerName,
            bool useDataCache,
            bool useBlobListCache,
            bool useBigFilesLazyLoad)
        {
            Assert.ArgumentNotNullOrEmpty(globalRootItemPath, nameof(globalRootItemPath));
            Assert.ArgumentNotNullOrEmpty(databaseName, nameof(databaseName));
            Assert.ArgumentNotNullOrEmpty(physicalRootPath, nameof(physicalRootPath));
            Assert.ArgumentNotNull(formatter, nameof(formatter));
            Assert.IsTrue(globalRootItemPath.StartsWith("/"),
                          "The global root item path must start with '/', e.g. '/sitecore' or '/sitecore/content'");
            Assert.IsTrue(globalRootItemPath.Length > 1,
                          "The global root item path cannot be '/' - there is no root item. You probably mean '/sitecore'.");

            this._globalRootItemPath = globalRootItemPath.TrimEnd('/');

            this.AssertValidPhysicalPath(physicalRootPath);
            this._useBigFilesLazyLoad = useBigFilesLazyLoad;
            this._physicalRootPath    = physicalRootPath;
            this._azureManager        = new AzureManager(connectionString, containerName, physicalRootPath, useBlobListCache);
            this._formatter           = formatter;
            this._dataCache           = new AzureBlobCache <IItemData>(this._azureManager, useDataCache);
            this._metadataCache       = new AzureBlobCache <IItemMetadata>(this._azureManager, true);

            this.Name         = name;
            this.DatabaseName = databaseName;

            this._azureManager.EnsureDirectory(this._physicalRootPath);
        }
示例#3
0
        public AzureLazyItemData(
            IItemMetadata itemMetadata,
            string filePath,
            IAzureManager azureManager,
            ISerializationFormatter serializationFormatter)
        {
            Assert.ArgumentNotNull(itemMetadata, nameof(itemMetadata));
            Assert.ArgumentNotNull(azureManager, nameof(azureManager));
            Assert.ArgumentNotNull(filePath, nameof(filePath));
            Assert.ArgumentNotNull(serializationFormatter, nameof(serializationFormatter));

            this.itemMetadata           = itemMetadata;
            this.azureManager           = azureManager;
            this.filePath               = filePath;
            this.serializationFormatter = serializationFormatter;

            // ToDo: fix it - to do the lazy read, the context is needed to be preserved.
            if (serializationFormatter is YamlSerializationFormatter yamlSerializationFormatter)
            {
                this.parentDataStore = yamlSerializationFormatter.ParentDataStore;
            }

            this.itemDataLazy = new Lazy <IItemData>(this.LoadItemData, LazyThreadSafetyMode.ExecutionAndPublication);
        }