Example #1
0
        public CacheService GetCacheService()
        {
            string cache_key = CACHE_KEY + "_Service";

            CacheService service = null;

            var cache = HttpRuntime.Cache;

            object cacheObject = cache.Get(cache_key);

            if (cacheObject != null)
            {
                service = cacheObject as CacheService;
            }
            else
            {

                var setting = GetCacheSetting();

                if (setting != null)
                {
                    if (setting.Config.Enable)
                    {
                        service = new CacheService(setting, this);

                        cache.Insert(cache_key, service);
                    }
                }

            }

            return service;
        }
Example #2
0
        //初始化设置
        public bool InitSetting()
        {
            this.service = GetCacheService();

            if (this.service != null)
            {
                return true;
            }

            return false;
        }