Vs+Qt+C++电梯调度控制系统

news2024/9/20 21:35:47

程序示例精选

Vs+Qt+C++电梯调度控制系统

如需安装运行环境或远程调试,见文章底部个人QQ名片,由专业技术人员远程协助!

前言

这篇博客针对<<Vs+Qt+C++电梯调度控制系统>>编写代码,代码整洁,规则,易读。 学习与应用推荐首选。


文章目录

一、所需工具软件

二、使用步骤

        1. 引入库

        2. 代码实现

        3. 运行结果

三、在线协助

一、所需工具软件

1. VS,Qt

2. C++

二、使用步骤

1.引入库

#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QAbstractAnimation>
#include <QTime>

#include "controller.h"

#include<QMessageBox.h>;
#include<iostream>
using namespace std;

2. 代码实现

代码如下:


MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent), ui(new Ui::MainWindow) {
  ui->setupUi(this);

  //以主界面为父窗口创建滚动条
  QScrollArea* pScroll = new QScrollArea(this);

  //清空数据
  QObject::connect(ui->pushButton, SIGNAL(clicked()), this, SLOT(clearData()));
  QObject::connect(ui->pushButton_2, SIGNAL(clicked()), this, SLOT(averTime()));
  QObject::connect(ui->pushButton_3, SIGNAL(clicked()), this, SLOT(personNumber()));

  ui->checkBox_6->setVisible(false);
  ui->checkBox_7->setVisible(false);
  ui->checkBox_8->setVisible(false);


  //setWindowFlags(windowFlags() &
  //               ~Qt::WindowMaximizeButtonHint); // 禁止最大化按钮
  setWindowFlags(windowFlags() ); // 禁止最大化按钮
  //setFixedSize(this->width(), this->height());
  this->setWindowTitle("Elevator");
  this->setWindowIcon(QIcon(":/new/image/image/little door.png"));
  ctrl = new Controller();
  playerList = new QMediaPlaylist;
  player = new QMediaPlayer;
  playerList->addMedia(QUrl("qrc:/new/image/music/ding.mp3"));
  playerList->setCurrentIndex(0);
  player->setPlaylist(playerList);
  player->setVolume(50);
  init();
  setAnimation();
  setConnection();
  setStyleSheet(
      //正常状态样式
      "QPushButton{"
      "border-radius:5px;"
      "border:2px solid gray;"
      "color:black;"
      //"padding-left:8px;"
      //"padding-right:8px;"
      //"padding-top:8px;"
      //"padding-bottom:8px;"
      "}"
      //鼠标悬停样式
      "QPushButton:hover{"
      "background-color:green;"
      "color:black;"
      "}"
      //鼠标按下样式
      "QPushButton:pressed{"
      "background-color:red;"
      "border:2px solid gray;"
      "color:rgba(0,0,0,100);"
      "}"
      //设置数字显示
      "QLCDNumber{"
      "border:20px black;"
      "color:red;"
      "background:silver;"
      "}"
      //设置滑块显示
      "QSlider::groove:vertical{"
      "border: 1px solid #bbb;"
      "background: white;"
      "height: 802px;"
      "width:50px;"
      "border-radius: 4px;"
      "}"
      "QSlider::handle:vertical{"
      "background: qlineargradient(x1:0, y1:0, x2:1, y2:1,  stop:0 #eee, "
      "stop:1 #ccc);"
      "border: 1px solid #777;"
      "border-image: url(:/new/image/image/little door.png);"
      "background: green;"
      "border-radius:4px;"
      "width: 50px;"
      "height: 50px;"
      "margin-top: -2px;"
      "margin-bottom: -2px;"
      "}");
}

void MainWindow::init() {
  QList<QGraphicsView *> graphicsViewList =
      ui->centralwidget->findChildren<QGraphicsView *>();
  auto it = graphicsViewList.begin();
  for (int i = 0; i < 5; i++) {
    it++;
  }
  for (int i = 0; i < 5; i++) {
    upDownButton[i] = *it;
    it++;
  }
  for (int i = 0; i < 10; i++) {
    door[i] = *it;
    elevAnimation[i] = new QPropertyAnimation(door[i], "geometry");
    it++;
  }
  for (int i = 0; i < ELEVATOR_NUM; i++) {
    person[i] = *it;
    person[i]->setVisible(false);
    preAnimation[i] = new QPropertyAnimation(person[i], "geometry");
    it++;
  }
  QList<QLCDNumber *> lcdNumberList =
      ui->centralwidget->findChildren<QLCDNumber *>();
  QList<QSlider *> sliderList = ui->centralwidget->findChildren<QSlider *>();
  auto it_2 = sliderList.begin();
  auto it_5 = lcdNumberList.begin();
  QList<QCheckBox *> checkboxList =
      ui->centralwidget->findChildren<QCheckBox *>();
  auto it_3 = checkboxList.begin();
  for (int i = 0; i < ELEVATOR_NUM; i++) {
    ctrl->myElevator[i].elevatorUi = *it_2;
    ctrl->myElevator[i].lock = *it_3;
    ctrl->myElevator[i].elevatorLCD = *it_5;
    ctrl->myElevator[i].elevatorUi->setEnabled(false);
    it_2++;
    it_3++;
    it_5++;
  }

  //
  //让每个电梯类的TIMESPANLINEDIT指向UI对应的LINEEDIT
  for (int i = 0; i < ELEVATOR_NUM; i++) {
      ctrl->myElevator[i].timeSpanLineEdit = ui->lineEdit_timespan;
      ctrl->myElevator[i].timeButtontimeLineEdit = ui->lineEdit_button;
      ctrl->myElevator[i].timeOpentimeLineEdit = ui->lineEdit_3;



  }

  ctrl->calDoorTime = *it_3;
  it_3++;
  ctrl->calRepairTime = *it_3;
  it_3++;
  ctrl->calOpenTime = *it_3;
  QList<QPushButton *> buttonList =
      ui->centralwidget->findChildren<QPushButton *>();
  auto it_4 = buttonList.begin();
  for (int i = 0; i < ELEVATOR_NUM; i++) {
    for (int j = 0; j < FLOOR; j++) {
      ctrl->myElevator[i].floorButton[j] = *it_4;
      connect(*it_4, SIGNAL(clicked(bool)), this, SLOT(clickFloor()));
      it_4++;
    }
    ctrl->myElevator[i].floorButton[20] = *it_4;
    connect(*it_4, SIGNAL(clicked(bool)), this, SLOT(clickWarning()));
    it_4++;
    ctrl->myElevator[i].floorButton[21] = *it_4;
    connect(*it_4, SIGNAL(clicked(bool)), this, SLOT(clickPhone()));
    it_4++;
  }
  for (int i = 0; i < FLOOR; i++) {
    for (int j = 0; j < 2; j++) {
      floorButton[i][j] = *it_4;
      connect(*it_4, SIGNAL(clicked(bool)), this, SLOT(clickDirection()));
      it_4++;
    }
  }
  floorButton[19][1]->setEnabled(false);
  floorButton[0][0]->setEnabled(false);
  for (int i = 0; i < ELEVATOR_NUM; i++) {
    ctrl->myElevator[i].floorButton[22] = *it_4;
    connect(*it_4, SIGNAL(clicked(bool)), this, SLOT(clickOpen()));
    it_4++;
    ctrl->myElevator[i].floorButton[23] = *it_4;
    connect(*it_4, SIGNAL(clicked(bool)), this, SLOT(clickClose()));
    it_4++;
  }
}

void MainWindow::setAnimation() {
    int leftoffset = 210;
    int belowoffset = 20;
  for (int i = 0; i < ELEVATOR_NUM; i++) {
    elevAnimation[2 * i]->setDuration(1000);
    elevAnimation[2 * i]->setStartValue(QRect(leftoffset+37 + 180 * i, belowoffset+45, 42, 127));
    elevAnimation[2 * i]->setEndValue(QRect(leftoffset + 37 + 180 * i, belowoffset + 45, 0, 127));
    elevAnimation[2 * i + 1]->setDuration(1000);
    elevAnimation[2 * i + 1]->setStartValue(QRect(leftoffset + 78 + 180 * i, belowoffset + 45, 42, 127));
    elevAnimation[2 * i + 1]->setEndValue(QRect(leftoffset + 120 + 180 * i, belowoffset + 45, 0, 127));
  }
  for (int i = 0; i < ELEVATOR_NUM; i++) {
    preAnimation[i]->setDuration(1500);
    preAnimation[i]->setStartValue(QRect(leftoffset + 0 + 180 * i, belowoffset + 90, 51, 111));
    preAnimation[i]->setEndValue(QRect(leftoffset + 50 + 180 * i, belowoffset + 60, 51, 111));
  }
}

void MainWindow::setConnection() {
  connect(this, SIGNAL(warning(int)), ctrl, SLOT(warningState(int)));
  connect(this, SIGNAL(phone(int)), ctrl, SLOT(phoneState(int)));
  connect(this, SIGNAL(controlDoor(int, int)), ctrl,
          SLOT(controlDoorState(int, int)));
  connect(this, SIGNAL(inMessage(int, int)), ctrl, SLOT(distribute(int, int)));
  connect(this, SIGNAL(outMessage(int, int)), ctrl,
          SLOT(selectBestElev(int, int)));
  connect(ctrl, SIGNAL(open(int)), this, SLOT(doorOpenAni(int)));
  connect(ctrl, SIGNAL(close(int)), this, SLOT(doorCloseAni(int)));
  connect(ctrl, SIGNAL(change(int, int)), this, SLOT(changeButton(int, int)));
  connect(ctrl, SIGNAL(recover(int, int)), this, SLOT(recoverButton(int, int)));
}

void MainWindow::getMessage(QString objectName, int *curMessage) {
  QStringList sl = objectName.split("_");
  QByteArray byte = sl.at(0).toUtf8();
  curMessage[0] = int(byte.at(0)) - 96;
  curMessage[1] = sl.at(1).toInt();
}

void MainWindow::openDoor(int elevatorID) {
  elevAnimation[2 * elevatorID]->setDirection(
      QAbstractAnimation::Forward); //正向设定动画
  elevAnimation[2 * elevatorID + 1]->setDirection(QAbstractAnimation::Forward);
  elevAnimation[2 * elevatorID]->start();
  elevAnimation[2 * elevatorID + 1]->start();
}

void MainWindow::closeDoor(int elevatorID) {
  elevAnimation[2 * elevatorID]->setDirection(
      QAbstractAnimation::Backward); //反向设定动画
  elevAnimation[2 * elevatorID + 1]->setDirection(QAbstractAnimation::Backward);
  elevAnimation[2 * elevatorID]->start();
  elevAnimation[2 * elevatorID + 1]->start();
}

void MainWindow::personIn(int elevatorID) {
  person[elevatorID]->setVisible(true);
  setPersonTop(elevatorID);
  preAnimation[elevatorID]->setDirection(QAbstractAnimation::Forward);
  preAnimation[elevatorID]->start();
  QTimer::singleShot(1.5 * 1000, this,
                     [&, elevatorID]() { setDoorTop(elevatorID); });
}

void MainWindow::personOut(int elevatorID) {
  person[elevatorID]->setVisible(true);
  setPersonTop(elevatorID);
  preAnimation[elevatorID]->setDirection(QAbstractAnimation::Backward);
  preAnimation[elevatorID]->start();
  QTimer::singleShot(1 * 1000, this, [&, elevatorID]() {
    person[elevatorID]->setVisible(false);
  });
}

void MainWindow::setDoorTop(int elevatorID) {
  door[2 * elevatorID]->raise();
  door[2 * elevatorID + 1]->raise();
}

void MainWindow::setPersonTop(int elevatorID) { person[elevatorID]->raise(); }

void MainWindow::clickFloor() {
  int curMessage[2];
  QPushButton *button = qobject_cast<QPushButton *>(sender());
  button->setStyleSheet("background-color:red;font: 9pt 'Stencil';");
  getMessage(button->objectName(), curMessage);
  emit inMessage(curMessage[0], curMessage[1]);
}

void MainWindow::clickDirection() {

  qDebug() << "somebody press up or down bottom: ";
  int curMessage[2];
  int direction;
  QPushButton *button = qobject_cast<QPushButton *>(sender());
  button->setStyleSheet("background-color:red;font: 9pt 'Stencil';");
  getMessage(button->objectName(), curMessage);
  if (curMessage[0] == UPDIRECTION) {
    direction = UPSTATE;
  } else {
    direction = DOWNSTATE;
  }
  floorButton[curMessage[1] - 1][direction]->setEnabled(false);
  emit outMessage(direction, curMessage[1]);
}

void MainWindow::clickWarning() {
  int curMessage[2];
  QPushButton *button = qobject_cast<QPushButton *>(sender());
  //  button->setStyleSheet(
  //      "background-color:red;image: url(:/new/image/image/alarm bell.png);");
  getMessage(button->objectName(), curMessage);
  emit warning(curMessage[0]);
}

void MainWindow::clickPhone() {
  int curMessage[2];
  QPushButton *button = qobject_cast<QPushButton *>(sender());
  getMessage(button->objectName(), curMessage);
  emit phone(curMessage[0]);
}

void MainWindow::clickOpen() {
  int curMessage[2];
  QPushButton *button = qobject_cast<QPushButton *>(sender());
  button->setStyleSheet("font: 9pt '黑体';");
  getMessage(button->objectName(), curMessage);
  emit controlDoor(curMessage[0], curMessage[1]);
}

void MainWindow::clickClose() {
  int curMessage[2];
  QPushButton *button = qobject_cast<QPushButton *>(sender());
  button->setStyleSheet("font: 9pt '黑体';");
  getMessage(button->objectName(), curMessage);
  emit controlDoor(curMessage[0], curMessage[1]);
}

void MainWindow::doorOpenAni(int elevatorID) {
  openDoor(elevatorID);
  personIn(elevatorID);
  player->play();
  QTimer::singleShot(1 * 1000, this,
                     [&, elevatorID]() { closeDoor(elevatorID); });
}

void MainWindow::doorCloseAni(int elevatorID) {
  openDoor(elevatorID);
  personOut(elevatorID);
  player->play();
  QTimer::singleShot(1 * 1000, this,
                     [&, elevatorID]() { closeDoor(elevatorID); });
}

void MainWindow::changeButton(int elevatorID, int state) {
  if (state == FREESTATE) {
    upDownButton[elevatorID]->setStyleSheet(
        "border-image: url(:/new/image/image/nothing button.png);");
  } else if (state == UPSTATE) {
    upDownButton[elevatorID]->setStyleSheet(
        "border-image: url(:/new/image/image/up button.png);");
  } else if (state == DOWNSTATE) {
    upDownButton[elevatorID]->setStyleSheet(
        "border-image: url(:/new/image/image/down button.png);");
  }
}

void MainWindow::recoverButton(int direction, int floor) {
  floorButton[floor - 1][direction]->setEnabled(true);
  floorButton[floor - 1][direction]->setStyleSheet("border-radius:15px;"
                                                   "border:2px solid gray;"
                                                   "color:black;"
                                                   "font: 9pt 'Stencil';");
}


void MainWindow::clearData()
{
    QFile file1(QString::fromStdString("outElevator.txt"));
    if (file1.exists())
    {
        file1.remove();
    }
    file1.close();

    QFile file2(QString::fromStdString("doorNo.txt"));
    if (file2.exists())
    {
        file2.remove();
    }
    file2.close();
}

float sumData = 0;
float lineNum = 0;
void MainWindow::averTime()
{
    QFile file("outElevator.txt");
    if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
        qDebug() << "Can't open the file!" << endl;
    }
    //一行一行直接读取文件
    while (!file.atEnd()) {
        QByteArray line = file.readLine();
        QString str(line);
        qDebug() <<"str: "<< str;

        sumData = sumData + str.toFloat();
        lineNum = lineNum + 1;
    }

    qDebug() << "sumData: " << sumData;
    qDebug() << "lineNum: " << lineNum;

    file.close();
    //float frameDistance2 = round(10 / (sumData / lineNum) * 100) / 100.0;
    float frameDistance2 =sumData / lineNum;
    qDebug() << "frameDistance2: " << frameDistance2;
    QString aaa=QString("%1").arg(frameDistance2);
    ui->averLineEdit->setText(aaa);
}

void MainWindow::personNumber()
{
    QString doorOpenNumberLE = ui->doorOpenNumberLineEdit->text();
    QFile filetxt(QString::fromStdString("doorOpenNumber.txt"));
    if (filetxt.open(QIODevice::WriteOnly))
    {
        QTextStream out(&filetxt);
        out << doorOpenNumberLE.toInt() << "\n";
        out.setCodec("UTF-8");
        out.flush();

    }
    filetxt.close();
}

MainWindow::~MainWindow() { delete ui; }

3. 运行结果

三、在线协助:

如需安装运行环境或远程调试,见文章底部个人 QQ 名片,由专业技术人员远程协助!
1)远程安装运行环境,代码调试
2)Qt, C++, Python入门指导
3)界面美化
4)软件制作

博主推荐文章:python人脸识别统计人数qt窗体-CSDN博客

博主推荐文章:Python Yolov5火焰烟雾识别源码分享-CSDN博客

                         Python OpenCV识别行人入口进出人数统计_python识别人数-CSDN博客

个人博客主页:alicema1111的博客_CSDN博客-Python,C++,网页领域博主

博主所有文章点这里:alicema1111的博客_CSDN博客-Python,C++,网页领域博主

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/548083.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

PT100温度采集

1、信号采集的基本原理 PT100是将温度信号转换为电阻输出&#xff0c;其电阻值变化范围为0~200Ω。AD转换器只能对电压进行转换&#xff0c;无法采集直接采集温度&#xff0c;因此&#xff0c;需要一个1mA恒电流源给PT100供电&#xff0c;将电阻变化转换为电压变化。使用恒流源…

linux 安装 maven 3.8 版本

文章目录 1&#xff1a;maven 仓库官网 2、下载安装包 3、使用&#xff1a;Xftp 上传到你想放的目录 4、解压文件 ​编辑 5、配置环境变量 ​编辑 6、刷新 /etc/profile 文件 7、查看maven 版本 1&#xff1a;maven 仓库官网 Maven – Download Apache Mavenhttps://mave…

【C++】模板的一点简单介绍

模板 前言泛型编程函数模板概念格式函数模板的原理函数模板的实例化 类模板类模板的定义格式类模板的实例化 前言 这篇博客讲的是模板的一些基本知识&#xff0c;并没有那么深入&#xff0c;但是如果你是为了过期末考试而搜的这篇博客&#xff0c;我觉得下面讲的是够了的。 之…

简单分享线程池的设计

温故而知新&#xff0c;可以为师矣。 线程池是什么 线程池&#xff08;Thread Pool&#xff09;是一种基于池化思想管理线程的工具&#xff0c;经常出现在多线程服务器中&#xff0c;如MySQL。 池化思想&#xff0c;就是为了提高对资源的利用率&#xff0c;减少对资源的管理&a…

MySQL---空间索引、验证索引、索引特点、索引原理

1. 空间索引 MySQL在5.7之后的版本支持了空间索引&#xff0c;而且支持OpenGIS几何数据模型 空间索引是对空间数据类型的字段建立的索引&#xff0c;MYSQL中的空间数据类型有4种&#xff0c;分别是&#xff1a; 类型 含义 说明 Geometry 空间数据 任何一种空间类型 Poi…

HCIA-VRP系统

目录 一&#xff0c;什么是VRP VRP提供的功能&#xff1a; VRP文件系统&#xff1a; VRP存储设备&#xff1a; 设备初始化过程&#xff1a; 设备管理方式&#xff1a; 1&#xff0c;Web界面&#xff1a;可视化操作&#xff0c;通过http和https登录&#xff08;192.168.1.…

信息安全工程复习

目录 第二章 从口令系统说起 2.1 身份鉴别常见手段及例子 2.2 多因子认证 2.3 计时攻击 2.4 口令机制 2.5 假托和钓鱼 第三章 安全协议 3.1 认证协议 3.2 安全协议攻击 3.3 密钥分配协议 3.4 课后作业 第四章 访问控制 4.1 概念 4.2 控制访问三要素 4.3 控制访问…

Windows服务

参考地址&#xff1a;https://www.cnblogs.com/2828sea/p/13445738.html 1. 新建服务 2. 在 service 下 添加安装程序 会自动添加 修改这两个文件属性&#xff1a; serviceInstaller1&#xff1a; DelayedAutoStart:是否自动启动Descrition:介绍服务&#xff08;自定义&…

chatgpt赋能Python-python3_图片处理

Python3图片处理&#xff1a;简单高效的图像处理工具 Python3作为一种高级编程语言&#xff0c;在科学、金融、工程等领域中广受欢迎。它具有简洁的语法、快速的开发速度、多样化的应用场景等特点。其中&#xff0c;Python3在图像处理方面也非常出色&#xff0c;本文将介绍Pyt…

pg事务:事务的处理

事务的处理 事务块 从事务形态划分可分为隐式事务和显示事务。隐式事务是一个独立的SQL语句&#xff0c;执行完成后默认提交。显示事务需要显示声明一个事务&#xff0c;多个sql语句组合到一起称为一个事务块。 事务块通过begin&#xff0c;begin transaction&#xff0c;st…

【学习日记2023.5.20】 之 菜品模块完善

文章目录 3. 功能模块完善之菜品模块3.1 公共字段自动填充3.1.1 问题分析3.1.2 实现思路3.1.3 代码开发1.3.1 步骤一1.3.2 步骤二1.3.3 步骤三 3.1.4 功能测试3.1.5 提交代码 3.2 新增菜品3.2.1 需求分析与设计3.2.2 代码开发3.2.2.1 文件上传实现3.2.2.2 新增菜品实现 3.2.3 功…

pg事务:快照

pg中的快照 快照&#xff08;snapshot&#xff09;是记录数据库当前瞬时状态的一个数据结构。pg数据库的快照保存当前所有活动事务的最小事务ID、最大事务ID、当前活跃事务列表、当前事务的command id等 快照数据保存在SnapshotData结构体类型中&#xff0c;源码src/include/u…

PyQt5桌面应用开发(16):定制化控件-QPainter绘图

本文目录 PyQt5桌面应用系列画画图&#xff0c;喝喝茶QPainter和QPixmapQPixmapQPainter绘制事件 一个魔改的QLabelCanvas类主窗口主程序&#xff1a; 总结 PyQt5桌面应用系列 PyQt5桌面应用开发&#xff08;1&#xff09;&#xff1a;需求分析 PyQt5桌面应用开发&#xff08;2…

深入了解vector

vector 1. vector的介绍及使用1.1 vector的介绍1.2 vector的使用1.2.1 vector的定义&#xff08;(constructor)构造函数声明&#xff09;1.2.2 vector iterator 的使用1.2.3 vector Capacity1.2.4 vector Modifiers1.2.4 vector 迭代器失效问题 2. vector模拟实现 1. vector的介…

快速排序的三种方法

今日复习了一下快速排序的算法。 hoare法 快速排序由Hoare在1960年提出。它的基本思想是&#xff1a;通过排序将需要排序的数据分割成独立的两部分&#xff0c;左边的所有数据都比右边的小&#xff0c;然后再按此方法对这两部分数据分别进行快速排序递归&#xff0c;使其变成有…

时间序列预测 | 基于秃鹰算法优化BP神经网络(BES-BP)的时间序列预测,matlab代码

文章目录 效果一览文章概述部分源码参考资料效果一览 文章概述 基于秃鹰算法优化BP神经网络(BES-BP)的时间序列预测,matlab代码 评价指标包括:R2、MAE、MSE、RMSE等,代码质量极高,方便学习和替换数据。 部分源码 %% 清空环境变量 warning off % 关闭报警信息…

BurpSuite—-Spider模块(蜘蛛爬行)

本文主要介绍BurpSuite—-Spider模块(蜘蛛爬行)的相关内容 关于BurpSuite的安装可以看一下之前这篇文章&#xff1a; http://t.csdn.cn/0Qw2n 一、简介 Burp Spider 是一个映射 web 应用程序的工具。它使用多种智能技术对一个应用程序的内容和功能进行全面的清查。 Burp Spi…

基于Qt+FFmpeg的视频监控系统

github源码 需求分析 假设一个业务场景&#xff1a;每个员工工位旁有两个网络摄像头。老板需要一个员工监控软件&#xff0c;在上班时软件可以拉取RTSP视频流&#xff0c;也可以随时录制视频。这样老板就可以知道谁在摸鱼了 ◕‿◕ 为防有人上纲上线&#xff0c;在此特别声明…

【Redis】聊一下缓存双写一致性

缓存虽然可以提高查询数据的的性能&#xff0c;但是在缓存和数据 进行更新的时候 其实会出现数据不一致现象&#xff0c;而这个不一致其实可能会给业务来带一定影响。无论是Redis 分布式缓存还是其他的缓存机制都面临这样的问题。 数据不一致是如何发生&#xff1f; 数据一致…

【c语言】文件复制原理

创作不易&#xff0c;本篇文章如果帮助到了你&#xff0c;还请点赞 关注支持一下♡>&#x16966;<)!! 主页专栏有更多知识&#xff0c;如有疑问欢迎大家指正讨论&#xff0c;共同进步&#xff01; &#x1f525;c语言系列专栏&#xff1a;c语言之路重点知识整合 &#x…