예제 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ReliableCloudCacheStorage"/> class using the specified storage account information, custom retry policy
        /// and custom implementation of <see cref="ICloudStorageEntitySerializer"/> interface.
        /// </summary>
        /// <param name="endpointInfo">The endpoint details for Windows Azure Caching Service.</param>
        /// <param name="retryPolicy">The custom retry policy that will ensure reliable access to the Caching Service.</param>
        /// <param name="dataSerializer">An instance of the component which performs custom serialization and deserialization of cache items.</param>
        public ReliableCloudCacheStorage(CachingServiceEndpointInfo endpointInfo, RetryPolicy retryPolicy, ICloudStorageEntitySerializer dataSerializer)
        {
            Guard.ArgumentNotNull(endpointInfo, "endpointInfo");
            Guard.ArgumentNotNull(retryPolicy, "retryPolicy");
            Guard.ArgumentNotNull(dataSerializer, "dataSerializer");

            this.retryPolicy    = retryPolicy;
            this.dataSerializer = dataSerializer;

            var cacheServers = new List <DataCacheServerEndpoint>(1);

            cacheServers.Add(new DataCacheServerEndpoint(endpointInfo.ServiceHostName, endpointInfo.CachePort));

            var cacheConfig = new DataCacheFactoryConfiguration()
            {
                Servers = cacheServers,
                MaxConnectionsToServer = 1,
                IsCompressionEnabled   = false,
                SecurityProperties     = new DataCacheSecurity(endpointInfo.SecureAuthenticationToken, endpointInfo.SslEnabled),
                // As per recommendations in http://blogs.msdn.com/b/akshar/archive/2011/05/01/azure-appfabric-caching-errorcode-lt-errca0017-gt-substatus-lt-es0006-gt-what-to-do.aspx
                TransportProperties = new DataCacheTransportProperties()
                {
                    ReceiveTimeout = TimeSpan.FromSeconds(45)
                }
            };

            this.cacheFactory = new DataCacheFactory(cacheConfig);
            this.cache        = this.retryPolicy.ExecuteAction <DataCache>(() =>
            {
                return(this.cacheFactory.GetDefaultCache());
            });
        }
예제 #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ReliableHybridBlobStorage"/> class using the specified storage account information, caching service endpoint
 /// and custom implementation of <see cref="ICloudStorageEntitySerializer"/> interface. Assumes the default use of <see cref="RetryPolicy.DefaultExponential"/>
 /// retry policies when accessing storage and caching services.
 /// </summary>
 /// <param name="storageAccountInfo">The access credentials for Windows Azure storage account.</param>
 /// <param name="cacheEndpointInfo">The endpoint details for Windows Azure Caching Service.</param>
 /// <param name="dataSerializer">An instance of the component which performs serialization and deserialization of storage objects.</param>
 public ReliableHybridBlobStorage(StorageAccountInfo storageAccountInfo, CachingServiceEndpointInfo cacheEndpointInfo, ICloudStorageEntitySerializer dataSerializer)
     : this
     (
         storageAccountInfo,
         new RetryPolicy <StorageTransientErrorDetectionStrategy>(RetryPolicy.DefaultClientRetryCount, RetryPolicy.DefaultMinBackoff, RetryPolicy.DefaultMaxBackoff, RetryPolicy.DefaultClientBackoff),
         cacheEndpointInfo,
         new RetryPolicy <CacheTransientErrorDetectionStrategy>(RetryPolicy.DefaultClientRetryCount, RetryPolicy.DefaultMinBackoff, RetryPolicy.DefaultMaxBackoff, RetryPolicy.DefaultClientBackoff),
         dataSerializer
     )
 {
 }
예제 #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ReliableHybridBlobStorage"/> class using the specified storage account information, caching service endpoint, custom retry policies
        /// and a custom implementation of <see cref="ICloudStorageEntitySerializer"/> interface.
        /// </summary>
        /// <param name="storageAccountInfo">The access credentials for Windows Azure storage account.</param>
        /// <param name="storageRetryPolicy">The custom retry policy that will ensure reliable access to the underlying blob storage.</param>
        /// <param name="cacheEndpointInfo">The endpoint details for Windows Azure Caching Service.</param>
        /// <param name="cacheRetryPolicy">The custom retry policy that will ensure reliable access to the Caching Service.</param>
        /// <param name="dataSerializer">An instance of the component which performs serialization and deserialization of storage objects.</param>
        public ReliableHybridBlobStorage(StorageAccountInfo storageAccountInfo, RetryPolicy storageRetryPolicy, CachingServiceEndpointInfo cacheEndpointInfo, RetryPolicy cacheRetryPolicy, ICloudStorageEntitySerializer dataSerializer)
        {
            Guard.ArgumentNotNull(storageAccountInfo, "storageAccountInfo");
            Guard.ArgumentNotNull(storageRetryPolicy, "storageRetryPolicy");
            Guard.ArgumentNotNull(cacheEndpointInfo, "cacheEndpointInfo");
            Guard.ArgumentNotNull(cacheRetryPolicy, "cacheRetryPolicy");
            Guard.ArgumentNotNull(dataSerializer, "dataSerializer");

            this.dataSerializer = dataSerializer;
            this.storageList    = new List <ICloudBlobStorage>(2);

            this.storageList.Add(this.cacheStorage = new ReliableCloudCacheStorage(cacheEndpointInfo, cacheRetryPolicy, dataSerializer));
            this.storageList.Add(this.blobStorage  = new ReliableCloudBlobStorage(storageAccountInfo, storageRetryPolicy, dataSerializer));
        }
예제 #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ReliableHybridBlobStorage"/> class using the specified storage account information and caching service endpoint.
 /// Assumes the default use of <see cref="RetryPolicy.DefaultExponential"/> retry policy and default implementation of <see cref="ICloudStorageEntitySerializer"/> interface.
 /// </summary>
 /// <param name="storageAccountInfo">The access credentials for Windows Azure storage account.</param>
 /// <param name="cacheEndpointInfo">The endpoint details for Windows Azure Caching Service.</param>
 public ReliableHybridBlobStorage(StorageAccountInfo storageAccountInfo, CachingServiceEndpointInfo cacheEndpointInfo)
     : this(storageAccountInfo, cacheEndpointInfo, new CloudStorageEntitySerializer())
 {
 }
예제 #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ReliableCloudCacheStorage"/> class using the specified caching service endpoint details and a custom retry policy.
 /// </summary>
 /// <param name="endpointInfo">The endpoint details for Windows Azure Caching Service.</param>
 /// <param name="retryPolicy">The custom retry policy that will ensure reliable access to the Caching Service.</param>
 public ReliableCloudCacheStorage(CachingServiceEndpointInfo endpointInfo, RetryPolicy retryPolicy)
     : this(endpointInfo, retryPolicy, new CloudStorageEntitySerializer())
 {
 }
예제 #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ReliableCloudCacheStorage"/> class using the specified caching service endpoint details.
 /// Assumes the default use of <see cref="RetryPolicy.DefaultExponential"/> retry policy and default implementation of <see cref="ICloudStorageEntitySerializer"/> interface.
 /// </summary>
 /// <param name="endpointInfo">The endpoint details for Windows Azure Caching Service.</param>
 public ReliableCloudCacheStorage(CachingServiceEndpointInfo endpointInfo)
     : this(endpointInfo, new RetryPolicy <CacheTransientErrorDetectionStrategy>(RetryPolicy.DefaultClientRetryCount, RetryPolicy.DefaultMinBackoff, RetryPolicy.DefaultMaxBackoff, RetryPolicy.DefaultClientBackoff))
 {
 }