Exemplo n.º 1
0
        public bool Load()
        {
            reloadTimer.Stop();

            bool loaded = true;

            try
            {
                CacheConnectionOptions cacheConnectionOptions = new CacheConnectionOptions();
                cacheConnectionOptions.AppName = cacheConnectionOptions.AppName = FeatureUsageCollector.FeatureTag + FeatureEnum.view_state;
                cache = CacheManager.GetCache(cacheName, cacheConnectionOptions);
            }
            catch (Exception ex)
            {
                loaded = false;
                FileBasedTraceProvider.Current.WriteTrace(TraceSeverity.Exception, "Could not initialize cache due to exception: {0}", ex.Message);
            }
            Loaded = loaded;

            if (!loaded)
            {
                ScheduleReload();
            }
            return(loaded);
        }
Exemplo n.º 2
0
        public CacheHandler(string cacheName, bool exceptionEnabled)
        {
            CacheConnectionOptions cacheConnectionOptions = new CacheConnectionOptions
            {
                AppName = FeatureUsageCollector.FeatureTag + FeatureEnum.hibernate
            };

            _cache = Alachisoft.NCache.Client.CacheManager.GetCache(cacheName, cacheConnectionOptions);

            _refCount++;
        }
Exemplo n.º 3
0
        void ScheduleReload()
        {
            Loaded = false;

            if (cache != null)
            {
                cache.Dispose();
            }

            cache = null;

            if (RetryInterval > 0)
            {
                reloadTimer.Interval = RetryInterval * 1000; // convert to miliseconds
                reloadTimer.Start();
            }
        }
Exemplo n.º 4
0
        public bool Load()
        {
            reloadTimer.Stop();

            bool loaded = true;

            try
            {
                cache = CacheManager.GetCache(cacheName);
            }
            catch (Exception ex)
            {
                loaded = false;
                FileBasedTraceProvider.Current.WriteTrace(TraceSeverity.Exception, "Could not initialize cache due to exception: {0}", ex.Message);
            }
            Loaded = loaded;

            if (!loaded)
            {
                ScheduleReload();
            }
            return(loaded);
        }