设计模式->单例模式

 public class RedisManagerSingleton
    {
        private static RedisManagerSingleton _redisManagerSingleton;

        private static readonly object _lock = new object();

        private RedisManagerSingleton()
        {
        }


        public static RedisManagerSingleton GetSingleton()
        {
            if (_redisManagerSingleton == null)
            {
                lock (_lock)
                {
                    if (_redisManagerSingleton == null)
                    {
                        _redisManagerSingleton = new RedisManagerSingleton();
                    }
                }
            }

            return _redisManagerSingleton;
        }
    }
上一篇:利用EasyExecl对execl进行导入导出


下一篇:Linux设备驱动中的并发控制