/// <summary> /// 设置临时仅允许访问主库(默认10秒) /// </summary> public void SetFocusOnMaster() { if (Slave.Count > 0) { string id = StaticTool.GetMasterSlaveKey();//获取当前的标识 Cache.CacheManage.LocalInstance.Set(id, 1, AppConfig.DB.MasterSlaveTime / 60.0); } }
public bool IsAllowSlave() { if (Slave.Count == 0) { return(false); } string id = StaticTool.GetMasterSlaveKey();//获取当前的标识 return(!Cache.CacheManage.LocalInstance.Contains(id)); }