コード例 #1
0
        private AzureBlockStore(AzureBlockStoreConfiguration configuration)
        {
#if BLOCKSTORECACHE
            _cache = new BlockStoreCache((long)configuration.MemoryCacheInMB * 1024 * 1024, configuration.LocalStorageKey);
#else
            ICache memoryCache = new MemoryCache((long)configuration.MemoryCacheInMB * 1024 * 1024, new LruCacheEvictionPolicy());
            if (!String.IsNullOrEmpty(configuration.LocalStorageKey))
            {
                var    localDiskResource = RoleEnvironment.GetLocalResource(configuration.LocalStorageKey);
                ICache diskCache         = new DirectoryCache(localDiskResource.RootPath,
                                                              ((long)localDiskResource.MaximumSizeInMegabytes - 1) * 1024 * 1024,
                                                              new LruCacheEvictionPolicy());
                _cache = new TwoLevelCache(memoryCache, diskCache);
            }
            else
            {
                _cache = memoryCache;
            }
#endif
            _highestPageOffsetByPath = new Dictionary <string, long>();
            _storageAccount          = CloudStorageAccount.Parse(configuration.ConnectionString);
            _commitList   = new ConcurrentQueue <BlockInfo>();
            _commitThread = new Thread(RunCommitThread);
            _commitThread.Start();
            _disconnected = configuration.Disconnected;
        }
コード例 #2
0
 public static void Initialize(AzureBlockStoreConfiguration configuration)
 {
     Instance = new AzureBlockStore(configuration);
 }