123456789101112131415161718192021222324252627282930313233343536373839404142 |
- using System;
- using System.Collections.Generic;
- using System.Text;
- using CB.Common;
- namespace CB.Cache.MemCached
- {
- /// <summary>
- /// 设置或载入MemCached的配置
- ///
- /// </summary>
- public class MemCachedConfig
- {
- private static object _lockHelper = new object();
- private static MemCachedConfigInfo config = null;
- public static void LoadConfig(string configfilepath)
- {
- if (config == null)
- {
- lock (_lockHelper)
- {
- if (config == null)
- {
- config = JSONUtil.ParseFormByJson<MemCachedConfigInfo>(Utils.ReadFile(configfilepath));
- }
- }
- }
- }
- /// <summary>
- /// 获取配置
- /// </summary>
- /// <param name="anConfig"></param>
- public static MemCachedConfigInfo GetConfig()
- {
- return config;
- }
- }
- }
|