예제 #1
0
        public RegionedAppFabricSearchCache(DataCache dataCache, ICacheItemPolicyFactory cacheItemPolicyFactory, string cacheRegionName)
        {
            if (dataCache == null)
            {
                throw new ArgumentNullException("dataCache");
            }
            if (cacheItemPolicyFactory == null)
            {
                throw new ArgumentNullException("cacheItemPolicyFactory");
            }
            if (cacheRegionName == null)
            {
                throw new ArgumentNullException("cacheRegionName");
            }

            this.DataCache = dataCache;
            this.CacheItemPolicyFactory = cacheItemPolicyFactory;
            this.CacheRegionName        = cacheRegionName;

            if (string.IsNullOrEmpty(this.CacheRegionName))
            {
                throw new ArgumentOutOfRangeException(cacheRegionName, "A non-empty CacheRegionName must be provided");
            }

            if (!this.DataCache.CreateRegion(this.CacheRegionName))
            {
                this.DataCache.ClearRegion(this.CacheRegionName);
            }
        }
 public CachedEmailTraceListener(string toAddress, string fromAddress, string subjectLineStarter, string subjectLineEnder, string smtpServer, int smtpPort, ILogFormatter formatter, EmailAuthenticationMode authenticationMode, string userName, string password, bool useSSL, double emailCacheDuration)
     : base(toAddress, fromAddress, subjectLineStarter, subjectLineEnder, smtpServer, smtpPort, formatter, authenticationMode, userName, password, useSSL)
 {
     this.emailCacheDuration = emailCacheDuration;
     if (emailCacheDuration > 0)
     {
         // Email cache duration is in hours
         this.cacheItemPolicyFactory = new AbsoluteCacheItemPolicyFactory(Convert.ToInt32(emailCacheDuration * 3600));
     }
 }
예제 #3
0
 public CachedEmailTraceListener(string toAddress, string fromAddress, string subjectLineStarter, string subjectLineEnder, string smtpServer, int smtpPort, ILogFormatter formatter, EmailAuthenticationMode authenticationMode, string userName, string password, bool useSSL, double emailCacheDuration)
     : base(toAddress, fromAddress, subjectLineStarter, subjectLineEnder, smtpServer, smtpPort, formatter, authenticationMode, userName, password, useSSL)
 {
     this.emailCacheDuration = emailCacheDuration;
     if (emailCacheDuration > 0)
     {
         // Email cache duration is in hours
         this.cacheItemPolicyFactory = new AbsoluteCacheItemPolicyFactory(Convert.ToInt32(emailCacheDuration * 3600));
     }
 }
예제 #4
0
        public override void ActivateOptions()
        {
            // log4net buffering always disabled - we make our own sending decisions
            this.BufferSize = 1;

            if (this.emailCacheDuration > 0)
            {
                // Email cache duration is in hours so convert it to seconds
                this.cacheItemPolicyFactory = new AbsoluteCacheItemPolicyFactory(Convert.ToInt32(this.emailCacheDuration * 3600));
            }
        }
 public override void ActivateOptions()
 {
     // log4net buffering always disabled - we make our own sending decisions
     this.BufferSize = 1;
     
     if (this.emailCacheDuration > 0)
     {
         // Email cache duration is in hours so convert it to seconds
         this.cacheItemPolicyFactory = new AbsoluteCacheItemPolicyFactory(Convert.ToInt32(this.emailCacheDuration * 3600));
     }
 }
 /// <summary>
 /// Create a new instance of the <see cref="CachePolicyMdmEntityService{T}" /> class.
 /// </summary>
 /// <param name="service"></param>
 /// <param name="cacheItemPolicyFactory"></param>
 public CachePolicyMdmEntityService(IMdmEntityService <TContract> service, ICacheItemPolicyFactory cacheItemPolicyFactory, IMdmClientCacheRepository mdmCacheRepository, uint version = 0)
 {
     this.service                = service;
     this.cacheName              = typeof(TContract).GetCacheNameFromEntityType(version);
     this.cacheRepository        = mdmCacheRepository;
     this.cache                  = cacheRepository.GetNamedCache(cacheName);
     this.searchCache            = cacheRepository.GetNamedCache("MDMSearchResultsCache");
     this.cacheItemPolicyFactory = cacheItemPolicyFactory;
     this.etags                  = new Dictionary <int, string>();
     this.syncLock               = new object();
     this.entityName             = typeof(TContract).Name;
     this.contractVersion        = version;
 }
예제 #7
0
        public OrganizationServiceCache(ObjectCache cache, OrganizationServiceCacheSettings settings)
        {
            var cacheSettings = settings ?? new OrganizationServiceCacheSettings();

            Cache      = cache ?? MemoryCache.Default;
            Mode       = OrganizationServiceCacheMode.LookupAndInsert;
            ReturnMode = OrganizationServiceCacheReturnMode.Cloned;

            ConnectionId                  = cacheSettings.ConnectionId;
            CacheRegionName               = cacheSettings.CacheRegionName;
            QueryHashingEnabled           = cacheSettings.QueryHashingEnabled;
            CacheEntryChangeMonitorPrefix = cacheSettings.CacheEntryChangeMonitorPrefix;
            _cacheItemPolicyFactory       = cacheSettings.PolicyFactory;
        }
        public RegionedAppFabricSearchCache(DataCache dataCache, ICacheItemPolicyFactory cacheItemPolicyFactory, string cacheRegionName)
        {
            if (dataCache == null) { throw new ArgumentNullException("dataCache"); }
            if (cacheItemPolicyFactory == null) { throw new ArgumentNullException("cacheItemPolicyFactory"); }
            if (cacheRegionName == null) { throw new ArgumentNullException("cacheRegionName"); }
            
            this.DataCache = dataCache;
            this.CacheItemPolicyFactory = cacheItemPolicyFactory;
            this.CacheRegionName = cacheRegionName;

            if (string.IsNullOrEmpty(this.CacheRegionName))
            {
                throw new ArgumentOutOfRangeException(cacheRegionName, "A non-empty CacheRegionName must be provided");
            }

            if (!this.DataCache.CreateRegion(this.CacheRegionName))
            {
                this.DataCache.ClearRegion(this.CacheRegionName);
            }
        }
예제 #9
0
 public SearchCache(ICacheItemPolicyFactory cacheItemPolicyFactory)
 {
     this.cacheItemPolicyFactory = cacheItemPolicyFactory;
     this.cache = new MemoryCache("EnergyTrading.SearchCache");
 }
예제 #10
0
 public SearchCache(ICacheItemPolicyFactory cacheItemPolicyFactory)
 {
     this.cacheItemPolicyFactory = cacheItemPolicyFactory;
     this.cache = new MemoryCache("EnergyTrading.SearchCache");
 }