[go: up one dir, main page]

CN111737303A - Data query method, device, computer equipment and storage medium - Google Patents

Data query method, device, computer equipment and storage medium Download PDF

Info

Publication number
CN111737303A
CN111737303A CN202010600092.2A CN202010600092A CN111737303A CN 111737303 A CN111737303 A CN 111737303A CN 202010600092 A CN202010600092 A CN 202010600092A CN 111737303 A CN111737303 A CN 111737303A
Authority
CN
China
Prior art keywords
data
target
redis cluster
query
change record
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202010600092.2A
Other languages
Chinese (zh)
Other versions
CN111737303B (en
Inventor
蓝苏俊
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Property and Casualty Insurance Company of China Ltd
Original Assignee
Ping An Property and Casualty Insurance Company of China Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Property and Casualty Insurance Company of China Ltd filed Critical Ping An Property and Casualty Insurance Company of China Ltd
Priority to CN202010600092.2A priority Critical patent/CN111737303B/en
Publication of CN111737303A publication Critical patent/CN111737303A/en
Application granted granted Critical
Publication of CN111737303B publication Critical patent/CN111737303B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • G06F16/24552Database cache management
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • G06F16/2365Ensuring data consistency and integrity
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Computational Linguistics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention relates to a block chain technology, and provides a data query method, which comprises the following steps: receiving a data query request; detecting whether a newly added data change record exists in a redis cluster; when the detection result is yes, analyzing the data change record to obtain a changed data processor identifier; detecting whether the changed data processor identification is consistent with the target identification; when the detection result is negative, inquiring the data cached in the redis cluster according to the data inquiry request to obtain target inquiry data; and storing the target query data into a target local storage corresponding to the target identifier. The invention also provides a data query device and related equipment. According to the invention, the resource data are prevented from being frequently acquired from the redis cluster in a mode of combining local storage and the redis cache, and the data processing efficiency is improved.

Description

数据查询方法、装置、计算机设备及存储介质Data query method, device, computer equipment and storage medium

技术领域technical field

本发明涉及数据处理技术领域,尤其涉及一种数据查询方法、装置、计算机设备及存储介质。The present invention relates to the technical field of data processing, and in particular, to a data query method, device, computer equipment and storage medium.

背景技术Background technique

在保险理赔系统中,保险理赔的每个环节都可能涉及到理赔人员的介入,进行人工理赔。大型保险理赔系统中的每个环节都需要查询用户角色、所属机构等信息,进行分配任务、控制权限、校验数据等。因而,为了提高保险理赔的数据处理能力,必须要提高用户信息的查询速率。In the insurance claims system, each link of insurance claims may involve the intervention of claims adjusters to make manual claims. Every link in a large insurance claims system needs to query information such as user roles and affiliations, assign tasks, control permissions, and verify data. Therefore, in order to improve the data processing capability of insurance claims, it is necessary to increase the query rate of user information.

在传统的用户信息查询过程中,用户信息一般存储于关系型数据库,例如,Mysql数据库、Oracle数据库。对于用户信息的查询一般需要基于数据库查询来实现。然而,当用户信息量较大时,仅仅依赖于关系型数据库来实现信息查询将会导致响应时间较长,且查询的冗余数据较多。In a traditional user information query process, user information is generally stored in a relational database, such as Mysql database and Oracle database. The query for user information generally needs to be implemented based on database query. However, when the amount of user information is large, only relying on the relational database to implement information query will result in a longer response time and more redundant data queried.

因而,亟待提供一种数据查询方法,以适应大资源数据量的快速查询。Therefore, it is urgent to provide a data query method to adapt to the fast query of large resource data volume.

发明内容SUMMARY OF THE INVENTION

鉴于以上内容,有必要提出一种数据查询方法、数据查询装置、计算机设备及计算机可读存储介质,以提高数据查询速率。In view of the above content, it is necessary to provide a data query method, data query device, computer equipment and computer-readable storage medium, so as to improve the data query rate.

本发明实施例提供一种数据查询方法,应用于目标数据处理器中,所述数据查询方法包括:An embodiment of the present invention provides a data query method, which is applied to a target data processor, and the data query method includes:

接收数据查询请求;Receive data query requests;

检测redis集群中是否存在新增的数据变更记录;Detect whether there is a new data change record in the redis cluster;

当检测结果为所述redis集群中存在新增的数据变更记录时,解析所述数据变更记录得到变更的数据处理器标识;When the detection result is that there is a newly added data change record in the redis cluster, analyze the data change record to obtain the changed data processor identifier;

检测所述变更的数据处理器标识与对应所述目标数据处理器的目标标识是否一致;Detecting whether the changed data processor identification is consistent with the target identification corresponding to the target data processor;

当检测结果为所述变更的数据处理器标识与所述目标标识不一致时,根据所述数据查询请求查询所述redis集群中缓存的数据,得到目标查询数据;When the detection result is that the changed data processor identifier is inconsistent with the target identifier, query the data cached in the redis cluster according to the data query request to obtain target query data;

存储所述目标查询数据至对应所述目标标识的目标本地存储中。The target query data is stored in the target local storage corresponding to the target identifier.

进一步地,在本发明实施例提供的上述数据查询方法中,在所述接收数据查询请求之前,所述方法还包括:Further, in the above data query method provided by the embodiment of the present invention, before the receiving a data query request, the method further includes:

获取当前剩余资源量;Get the current remaining resources;

检测所述当前剩余资源量是否大于预设资源量;Detecting whether the current remaining resource amount is greater than a preset resource amount;

当检测结果为所述当前剩余资源量大于预设资源量时,接收数据查询请求。When the detection result is that the current remaining resource amount is greater than the preset resource amount, a data query request is received.

进一步地,在本发明实施例提供的上述数据查询方法中,所述检测redis集群中是否存在新增的数据变更记录包括:Further, in the above data query method provided by the embodiment of the present invention, the detecting whether a new data change record exists in the redis cluster includes:

检测redis集群是否存在预设数据格式的数据,当检测结果为所述redis集群存在所述预设数据格式的数据时,确定所述redis集群中存在新增的数据变更记录;或者Detecting whether the redis cluster has data in the preset data format, and when the detection result is that the redis cluster has data in the preset data format, determine that a new data change record exists in the redis cluster; or

检测redis集群是否存在预设标签,当检测结果为所述redis集群存在所述预设标签时,确定所述redis集群中存在新增的数据变更记录。Detecting whether a preset tag exists in the redis cluster, and when the detection result is that the preset tag exists in the redis cluster, it is determined that a newly added data change record exists in the redis cluster.

进一步地,在本发明实施例提供的上述数据查询方法中,在所述接收数据查询请求之后,所述方法还包括:Further, in the above data query method provided by the embodiment of the present invention, after the data query request is received, the method further includes:

检测所述redis集群是否存在预设标记;Detect whether there is a preset mark in the redis cluster;

当检测结果为所述redis集群存在所述预设标记时,新增所述数据变更记录;When the detection result is that the preset mark exists in the redis cluster, the data change record is added;

当检测结果为所述redis集群不存在所述预设标记时,检测redis集群中是否存在新增的数据变更记录。When the detection result is that the preset mark does not exist in the redis cluster, it is detected whether there is a newly added data change record in the redis cluster.

进一步地,在本发明实施例提供的上述数据查询方法中,所述新增所述数据变更记录包括:Further, in the above data query method provided by the embodiment of the present invention, the adding the data change record includes:

查询预设数据库,所述预设数据库为区块链中的数据库,所述预设数据库中存储有最新的用户信息;querying a preset database, the preset database is a database in the blockchain, and the preset database stores the latest user information;

获取与所述预设标记对应的最新的用户信息;acquiring the latest user information corresponding to the preset mark;

存储所述最新的用户信息至对应所述目标标识的目标本地存储中;storing the latest user information in the target local storage corresponding to the target identifier;

存储所述最新的用户信息至所述redis集群中,并根据所述目标标识生成数据变更记录。The latest user information is stored in the redis cluster, and a data change record is generated according to the target identifier.

进一步地,在本发明实施例提供的上述数据查询方法中,在所述存储所述目标查询数据至对应所述目标标识的目标本地存储中之后,所述方法还包括:Further, in the above data query method provided by the embodiment of the present invention, after the target query data is stored in the target local storage corresponding to the target identifier, the method further includes:

根据所述目标标识生成目标数据变更记录;generating a target data change record according to the target identifier;

存储所述目标数据变更记录至所述redis集群中;Store the target data change record in the redis cluster;

获取所述redis集群中同一所述更新的用户信息对应的数据变更记录的数量;Obtain the number of data change records corresponding to the same updated user information in the redis cluster;

检测所述数据变更记录的数量与所述数据处理器的数量是否一致;Detecting whether the number of the data change records is consistent with the number of the data processors;

当检测结果所述数据变更记录的数量与所述数据处理器的数量一致时,删除所述redis集群中同一所述更新的用户信息对应的数据变更记录。When the detection result shows that the number of the data change records is consistent with the number of the data processors, delete the data change records corresponding to the same updated user information in the redis cluster.

进一步地,在本发明实施例提供的上述数据查询方法中,所述方法还包括:Further, in the above data query method provided by the embodiment of the present invention, the method further includes:

当检测结果为所述变更的数据处理器标识与所述目标标识一致时,确定所述目标标识对应的目标本地存储;When the detection result is that the changed data processor identifier is consistent with the target identifier, determine the target local storage corresponding to the target identifier;

根据所述数据查询请求查询所述目标本地存储,得到查询数据。Query the target local storage according to the data query request to obtain query data.

本发明实施例第二方面还提供一种数据查询装置,所述数据查询装置包括:A second aspect of the embodiments of the present invention further provides a data query device, where the data query device includes:

请求接收模块,用于接收数据查询请求;A request receiving module for receiving data query requests;

记录检测模块,用于检测redis集群中是否存在新增的数据变更记录;The record detection module is used to detect whether there is a new data change record in the redis cluster;

标识解析模块,用于当检测结果为所述redis集群中存在新增的数据变更记录时,解析所述数据变更记录得到变更的数据处理器标识;an identification parsing module, configured to parse the data change record to obtain the changed data processor identification when the detection result is that a newly added data change record exists in the redis cluster;

一致检测模块,用于检测所述变更的数据处理器标识与对应所述目标数据处理器的目标标识是否一致;a consistency detection module, for detecting whether the changed data processor identification is consistent with the target identification corresponding to the target data processor;

数据查询模块,用于当检测结果为所述变更的数据处理器标识与所述目标标识不一致时,根据所述数据查询请求查询所述redis集群中缓存的数据,得到目标查询数据;A data query module, configured to query the data cached in the redis cluster according to the data query request to obtain target query data when the detection result is that the changed data processor identifier is inconsistent with the target identifier;

数据存储模块,用于存储所述目标查询数据至对应所述目标标识的目标本地存储中。A data storage module, configured to store the target query data in a target local storage corresponding to the target identifier.

本发明实施例第三方面还提供一种计算机设备,所述计算机设备包括处理器,所述处理器用于执行存储器中存储的计算机程序时实现上述任意一项所述数据查询方法。A third aspect of the embodiments of the present invention further provides a computer device, where the computer device includes a processor, and the processor is configured to implement any one of the data query methods described above when executing the computer program stored in the memory.

本发明实施例第四方面还提供一种计算机可读存储介质,所述计算机可读存储介质上存储有计算机程序,所述计算机程序被处理器执行时实现上述任意一项所述数据查询方法。A fourth aspect of the embodiments of the present invention further provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, any one of the data query methods described above is implemented.

本发明实施例提供一种数据查询方法、数据查询装置、计算机设备及计算机可读存储介质,通过本地存储与redis集群缓存相结合的方式,避免频繁地从redis集群中获取资源数据,从而提高了数据处理效率。Embodiments of the present invention provide a data query method, a data query device, computer equipment, and a computer-readable storage medium. By combining local storage and redis cluster cache, frequent acquisition of resource data from the redis cluster is avoided, thereby improving the performance of the redis cluster. Data processing efficiency.

附图说明Description of drawings

图1是本发明第一实施方式提供的数据查询方法的流程图。FIG. 1 is a flowchart of a data query method provided by a first embodiment of the present invention.

图2是本发明一实施方式的计算机设备的结构示意图。FIG. 2 is a schematic structural diagram of a computer device according to an embodiment of the present invention.

图3是图2所示的计算机设备的示例性的功能模块图。FIG. 3 is an exemplary functional block diagram of the computer device shown in FIG. 2 .

如下具体实施方式将结合上述附图进一步说明本发明。The following specific embodiments will further illustrate the present invention in conjunction with the above drawings.

具体实施方式Detailed ways

为了能够更清楚地理解本发明的上述目的、特征和优点,下面结合附图和具体实施例对本发明进行详细描述。需要说明的是,在不冲突的情况下,本申请的实施例及实施例中的特征可以相互组合。In order to more clearly understand the above objects, features and advantages of the present invention, the present invention will be described in detail below with reference to the accompanying drawings and specific embodiments. It should be noted that the embodiments of the present application and the features in the embodiments may be combined with each other in the case of no conflict.

在下面的描述中阐述了很多具体细节以便于充分理解本发明,所描述的实施例是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。In the following description, numerous specific details are set forth in order to facilitate a full understanding of the present invention, and the described embodiments are some, but not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.

除非另有定义,本文所使用的所有的技术和科学术语与属于本发明的技术领域的技术人员通常理解的含义相同。本文中在本发明的说明书中所使用的术语只是为了描述具体的实施例的目的,不是旨在于限制本发明。Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs. The terms used herein in the description of the present invention are for the purpose of describing specific embodiments only, and are not intended to limit the present invention.

图1是本发明第一实施方式的数据查询方法的流程图。所述数据查询方法可以应用于保险理赔系统中,所述保险理赔系统包括保险理赔执行端、redis集群、维护用户信息的预设数据库、数据处理器及对应的本地存储。需要强调的是,为进一步保证用户信息的私密和安全性,上述预设数据库还可以为区块链中的数据库。如图1所示,所述数据查询方法应用于目标数据处理器中,所述目标数据处理器是指接收到数据查询方法的数据处理器,所述数据查询方法可以包括如下步骤:FIG. 1 is a flowchart of a data query method according to a first embodiment of the present invention. The data query method can be applied to an insurance claim settlement system, which includes an insurance claim settlement execution terminal, a redis cluster, a preset database for maintaining user information, a data processor, and a corresponding local storage. It should be emphasized that, in order to further ensure the privacy and security of user information, the above-mentioned preset database can also be a database in the blockchain. As shown in FIG. 1 , the data query method is applied to a target data processor, and the target data processor refers to a data processor that receives the data query method. The data query method may include the following steps:

S11、接收数据查询请求。S11. Receive a data query request.

在本发明的至少一实施例中,所述保险理赔执行端用于执行相关的保险理赔流程,保险理赔流程可以包括:报案、收单、核责、理算、复核、结案及支付等环节。从报案环节到支付环节,每一个环节都可能涉及到理赔人员的介入,进行人工理赔。因而,保险理赔流程的每一个环节都需要查询理赔人员的用户角色、所属机构等信息,用于分配任务、控制权限及校验数据等。In at least one embodiment of the present invention, the insurance claims execution end is used to execute related insurance claims procedures, and the insurance claims procedures may include: reporting, acquiring, checking, adjusting, reviewing, closing, and paying. From the reporting link to the payment link, every link may involve the intervention of claims adjusters to make manual claims. Therefore, each link of the insurance claims process needs to query the user roles, affiliations and other information of the claims adjusters, which are used to assign tasks, control permissions, and verify data.

所述数据查询请求是由所述保险理赔执行端输出的用于请求查询用户热点信息的请求,所述数据查询请求中携带有待查询的用户热点信息。所述用户热点信息为查询时出现频率较高的信息,所述用户热点信息包括用户ID、用户角色R及所属机构D,其中,同一用户可以对应不同用户角色,属于不同的机构,例如,用户U1可以对应机构D1中的R1角色,也可以对应机构D2中的R2角色,在此不作限制。The data query request is a request output by the insurance claim execution end for requesting to query user hotspot information, and the data query request carries the user hotspot information to be queried. The user hotspot information is information that appears frequently during query, and the user hotspot information includes user ID, user role R, and affiliated institution D, wherein the same user may correspond to different user roles and belong to different institutions, for example, the user U1 can correspond to the role of R1 in the organization D1, and can also correspond to the role of R2 in the organization D2, which is not limited here.

在本发明的至少一实施例中,所述保险理赔执行端与数据处理器建立通讯连接,所述数据处理器实质为信息查询与处理的执行单元,所述数据处理器用于接收所述保险理赔执行端输出的数据查询请求。对于每一所述数据处理器,都存在唯一的标识IP。例如,所述数据处理器的数量为4个,分别为数据处理器A、B、C及D,对应的标识分别为IP_A、IP_B、IP_C及IP_D。其中,确定接收数据查询请求的数据处理器为目标数据处理器,其对应的标识为目标标识。In at least one embodiment of the present invention, the insurance claim execution end establishes a communication connection with a data processor, the data processor is essentially an execution unit for information query and processing, and the data processor is used to receive the insurance claim The data query request output by the execution side. For each said data processor, there is a unique identification IP. For example, the number of the data processors is 4, which are data processors A, B, C, and D, respectively, and the corresponding identifiers are IP_A, IP_B, IP_C, and IP_D, respectively. Wherein, it is determined that the data processor receiving the data query request is the target data processor, and the corresponding identifier thereof is the target identifier.

在一保险理赔系统中,所述数据处理器的数量可以为多个,根据实际数据查询请求的负载均衡需求确定数据处理器的数量,所述数据处理器均用于响应所述数据查询请求进行数据查询。具体地,所述方法还包括:获取预设时长内接收到的数据查询请求的第一数量;确定每一数据处理器在所述预设时长内支线所述数据查询请求的第二数量;根据所述第一数量与所述第二数量确定数据处理器的数量。其中,所述预设时长为预先设置的,例如,所述预设时长可以为24小时。可以通过查询日志的方式获取预设时长内接收到的数据查询请求的第一数量。In an insurance claim settlement system, the number of data processors may be multiple, and the number of data processors is determined according to the load balancing requirement of the actual data query request, and the data processors are all used to respond to the data query request. data query. Specifically, the method further includes: acquiring a first number of data query requests received within a preset time period; determining a second number of the data query requests for branch lines of each data processor within the preset time period; according to The first number and the second number determine the number of data processors. The preset duration is preset, for example, the preset duration may be 24 hours. The first number of data query requests received within a preset time period can be obtained by querying the log.

在本发明的至少一实施例中,当所述数据处理器的数量为多个时,在所述接收数据查询请求之前,所述方法还包括:获取当前剩余资源量;检测所述当前剩余资源量是否大于预设资源量;当检测结果为所述当前剩余资源量大于预设资源量时,接收数据查询请求。其中,多个所述数据处理器对应设有初始资源,用于处理数据查询请求。当接收到数据查询请求时,数据处理器分配相关资源给所述保险理赔执行端,用于执行当前请求。所述预设资源量为处理一个数据查询请求需要消耗的资源量,所述预设资源量可以根据神经网络学习得到,也可以根据经验值所得,在此不作限制。In at least one embodiment of the present invention, when the number of the data processors is multiple, before the receiving a data query request, the method further includes: acquiring a current remaining resource; detecting the current remaining resource Whether the amount is greater than the preset resource amount; when the detection result is that the current remaining resource amount is greater than the preset resource amount, a data query request is received. Wherein, a plurality of the data processors are correspondingly provided with initial resources for processing data query requests. When receiving a data query request, the data processor allocates relevant resources to the insurance claim settlement execution end for executing the current request. The preset amount of resources is the amount of resources needed to process a data query request, and the preset amount of resources can be obtained according to neural network learning, or obtained according to empirical values, which is not limited herein.

具体地,用户在所述保险理赔执行端提交数据查询请求时,需要将相关用户信息(包括但不限于用户ID、用户角色、所属机构等)输入至所述保险理赔执行端对应的用户界面程序,所述用户界面程序会将相关用户信息传递给数据处理器的任务调度器,实现数据查询请求的提交过程。其中,所述用户界面程序可以是一个web应用程序,用户需要通过web浏览器操作用户界面程序;所述任务调度器用于对所述保险理赔执行端提交的任务进行分析及调度管理。Specifically, when a user submits a data query request on the insurance claim execution end, he needs to input relevant user information (including but not limited to user ID, user role, affiliation, etc.) into the user interface program corresponding to the insurance claim execution end , the user interface program will transmit the relevant user information to the task scheduler of the data processor to implement the submission process of the data query request. Wherein, the user interface program may be a web application program, and the user needs to operate the user interface program through a web browser; the task scheduler is used to analyze, schedule and manage the tasks submitted by the insurance claims execution end.

在本发明的至少一实施例中,在所述接收数据查询请求之后,所述方法还包括:检测所述redis集群是否存在预设标记;当检测结果为所述redis集群存在所述预设标记时,新增所述数据变更记录;当检测结果为所述redis集群不存在所述预设标记时,检测redis集群中是否存在新增的数据变更记录。具体地,所述新增所述数据变更记录包括:查询预设数据库,所述预设数据库中存储有最新的用户信息;获取与所述预设标记对应的最新的用户信息;存储所述最新的用户信息至对应所述目标标识的目标本地存储中;存储所述更新的用户信息至所述redis集群中,并根据所述目标标识生成数据变更记录。In at least one embodiment of the present invention, after the data query request is received, the method further includes: detecting whether the redis cluster has a preset mark; when the detection result is that the redis cluster has the preset mark , the data change record is newly added; when the detection result is that the preset mark does not exist in the redis cluster, it is detected whether there is a newly added data change record in the redis cluster. Specifically, the adding the data change record includes: querying a preset database, where the latest user information is stored; acquiring the latest user information corresponding to the preset mark; storing the latest user information The updated user information is stored in the target local storage corresponding to the target identifier; the updated user information is stored in the redis cluster, and a data change record is generated according to the target identifier.

在一实施例中,当所述预设数据库更新用户信息时,会向所述redis集群输出更新指示,并在所述redis集群中添加预设标记,所述预设标记包括用户热点信息。在其他实施例中,所述方法还包括:当检测结果为所述redis集群存在预设标记时,校验所述数据查询请求中携带的第一用户热点信息与所述预设标记表示的第二用户热点信息是否关联;当检验结果为所述数据查询请求中携带的第一用户热点信息与所述预设标记表示的第二用户热点信息关联时,新增所述数据变更记录;当校验结果为所述数据查询请求中携带的第一用户热点信息与所述预设标记表示的第二用户热点信息不关联时,检测redis集群中是否存在新增的数据变更记录。其中,校验所述数据查询请求中携带的第一用户热点信息与所述预设标记表示的第二用户热点信息是否关联也即校验所述第一用户热点信息与所述第二用户热点信息是否存在相同的信息项(信息项可以包括用户ID、用户角色R及所属机构D等信息),若存在相同的信息项,则两者相关联。可以理解的是,对于所述第一用户热点信息与所述第二用户热点信息不关联的情况,暂时停止新增所述数据变更记录,能够在一定程度上减少当前数据查询需要执行的操作,从而提高数据查询效率。In one embodiment, when the preset database updates user information, an update instruction is output to the redis cluster, and a preset marker is added to the redis cluster, and the preset marker includes user hotspot information. In other embodiments, the method further includes: when the detection result is that a preset mark exists in the redis cluster, verifying the first user hotspot information carried in the data query request and the first user hotspot information represented by the preset mark Whether the hotspot information of the two users is related; when the test result is that the hotspot information of the first user carried in the data query request is related to the hotspot information of the second user indicated by the preset mark, the data change record is added; When the verification result is that the first user's hotspot information carried in the data query request is not associated with the second user's hotspot information indicated by the preset mark, it is detected whether there is a newly added data change record in the redis cluster. Wherein, verifying whether the first user hotspot information carried in the data query request is related to the second user hotspot information indicated by the preset mark, that is, verifying the first user hotspot information and the second user hotspot information Whether the information has the same information item (the information item may include information such as user ID, user role R, and affiliated institution D, etc.), if there is the same information item, the two are associated. It can be understood that, for the situation that the hotspot information of the first user is not associated with the hotspot information of the second user, temporarily stopping adding the data change record can reduce the operations that need to be performed for the current data query to a certain extent. Thereby improving the efficiency of data query.

在一实施例中,当检测结果为所述redis集群中不存在预设标记时,说明所述预设数据库中用户热点信息并未发生更新,可执行检测redis集群中是否存在新增的数据变更记录的步骤;当检测结果为所述redis集群中存在预设标记时,说明所述预设数据库中的用户热点信息发生更新,则需查询预设数据库获取更新后的用户热点信息。In one embodiment, when the detection result is that there is no preset mark in the redis cluster, it means that the user hotspot information in the preset database has not been updated, and it can be performed to detect whether there is a new data change in the redis cluster. Recording step; when the detection result is that there is a preset mark in the redis cluster, it means that the user hotspot information in the preset database is updated, and the preset database needs to be queried to obtain the updated user hotspot information.

在一实施例中,设置处理机制,当预设数据库发生更新时,会向所述redis集群输出更新指示,并在所述redis集群中添加预设标记。对于当前接收到数据查询请求的目标数据处理器,在检测到所述redis集群中存在预设标记时,即需从所述预设数据库中获取更新的用户信息。In one embodiment, a processing mechanism is set, and when the preset database is updated, an update instruction is output to the redis cluster, and a preset mark is added to the redis cluster. For the target data processor that currently receives the data query request, when it is detected that a preset mark exists in the redis cluster, updated user information needs to be obtained from the preset database.

在一实施例中,对于每一数据处理器,都有与之对应的本地存储,所述本地存储用于存储所有的用户信息。例如,对于所述数据处理器A、B、C及D,与之对应的本地存储包括本地存储A、B、C及D。所述本地存储中存储的数据格式包括Map格式,其中,key为用户ID,value为用户的角色、所属机构等信息。In one embodiment, for each data processor, there is a corresponding local storage, and the local storage is used to store all user information. For example, for the data processors A, B, C and D, the corresponding local storage includes local storage A, B, C and D. The data format stored in the local storage includes a Map format, wherein the key is the user ID, and the value is the user's role, organization and other information.

S12、检测redis集群中是否存在新增的数据变更记录,当检测结果为所述redis集群中存在新增的数据变更记录时,执行步骤S13。S12. Detect whether a newly added data change record exists in the redis cluster, and when the detection result is that a newly added data change record exists in the redis cluster, step S13 is performed.

在本发明的至少一实施例中,所述redis集群与维护用户信息的预设数据库相关联,所述预设数据库可以为Mysql类型的数据库,所述预设数据库中存储有用户的所有信息,包括:用户热点信息与用户非热点信息,其中,用户非热点信息包括用户电话、邮箱、性别等信息。所述Redis集群中缓存有所述预设数据库中的所有用户热点信息,利用redis集群的负载均衡能力和错误恢复能力,实现了资源数据缓存的可扩展性和高可用性,避免频繁地从预设数据库中获取数据,从而加快数据读取速度。In at least one embodiment of the present invention, the redis cluster is associated with a preset database that maintains user information, the preset database may be a Mysql type database, and the preset database stores all user information, Including: user hotspot information and user non-hotspot information, wherein the user's non-hotspot information includes user phone, email, gender and other information. All user hotspot information in the preset database is cached in the Redis cluster, and the load balancing capability and error recovery capability of the redis cluster are used to realize the scalability and high availability of resource data caching, avoiding frequent changes from the preset database. Obtain data from the database, thereby speeding up data reading.

在本发明的至少一实施例中,所述数据处理器可以向Redis集群输出检测指令,所述检测指令用于检测redis集群中是否存在新增的数据变更记录。所述数据变更记录按照预设数据格式进行存储,所述数据变更记录上可设有标签,用于标识所述数据变更记录。所述数据变更记录包括:变更的数据处理器IP、是否已经变更与变更的用户ID。所述数据变更记录用于表明当前IP对应的数据处理器已经对用户ID的相关数据进行变更。In at least one embodiment of the present invention, the data processor may output a detection instruction to the Redis cluster, where the detection instruction is used to detect whether a new data change record exists in the redis cluster. The data change record is stored according to a preset data format, and a label may be provided on the data change record for identifying the data change record. The data change record includes: the changed data processor IP, whether it has been changed and the changed user ID. The data change record is used to indicate that the data processor corresponding to the current IP has changed the relevant data of the user ID.

在本发明的至少一实施例中,所述检测redis集群中是否存在新增的数据变更记录包括:检测redis集群是否存在预设数据格式的数据,当检测结果为所述redis集群存在所述预设数据格式的数据时,确定所述redis集群中存在新增的数据变更记录。或者,所述检测redis集群中是否存在新增的数据变更记录的步骤还包括:检测redis集群是否存在预设标签,当检测结果为所述redis集群存在所述预设标签时,确定所述redis集群中存在新增的数据变更记录。In at least one embodiment of the present invention, the detecting whether a new data change record exists in the redis cluster includes: detecting whether the redis cluster has data in a preset data format, and when the detection result is that the redis cluster has the preset data format When setting the data in the data format, it is determined that a newly added data change record exists in the redis cluster. Alternatively, the step of detecting whether a new data change record exists in the redis cluster further includes: detecting whether a preset label exists in the redis cluster, and when the detection result is that the redis cluster has the preset label, determining the redis cluster A new data change record exists in the cluster.

S13、解析所述数据变更记录得到变更的数据处理器标识。S13. Parse the data change record to obtain the changed data processor identifier.

在本发明的至少一实施例中,所述数据变更记录包括变更的数据处理器IP、是否已经变更、变更的用户热点信息。所述数据变更记录用于表明当前IP对应的数据处理器已经对用户ID的相关数据进行变更。In at least one embodiment of the present invention, the data change record includes the changed data processor IP, whether it has been changed, and the changed user hotspot information. The data change record is used to indicate that the data processor corresponding to the current IP has changed the relevant data of the user ID.

在其他实施例中,在所述解析所述数据变更记录得到变更的数据处理器标识之前,所述方法还可以包括:解析所述数据变更记录得到所述变更的用户热点信息;校验所述数据查询请求中携带的第一用户热点信息与所述变更的用户热点信息是否关联;当校验结果为所述数据查询请求中携带的第一用户热点信息与所述变更的用户热点信息关联时,继续执行步骤S13;当校验结果为所述数据查询请求中携带的第一用户热点信息与所述变更的用户热点信息不关联时,确定对应所述目标数据处理器的目标本地存储,并在所述目标本地存储中执行所述数据查询请求。可以理解的是,对于所述第一用户热点信息与所述变更的用户热点信息不关联的情况,所述第一用户热点信息未变更,所述目标本地存储中存储有所述第一用户热点信息,直接查询所述目标本地存储,提高了数据查询效率。In other embodiments, before analyzing the data change record to obtain the changed data processor identifier, the method may further include: analyzing the data change record to obtain the changed user hotspot information; verifying the Whether the first user hotspot information carried in the data query request is associated with the changed user hotspot information; when the verification result is that the first user hotspot information carried in the data query request is associated with the changed user hotspot information , continue to perform step S13; when the verification result is that the first user hotspot information carried in the data query request is not associated with the changed user hotspot information, determine the target local storage corresponding to the target data processor, and The data query request is executed in the target local storage. It can be understood that, in the case where the first user hotspot information is not associated with the changed user hotspot information, the first user hotspot information is not changed, and the first user hotspot is stored in the target local storage. information, directly query the target local storage, and improve the data query efficiency.

S14、检测所述变更的数据处理器标识与对应所述目标数据处理器的目标标识是否一致,当检测结果为所述变更的数据处理器标识与所述目标标识不一致时,执行步骤S15。S14. Detect whether the changed data processor identifier is consistent with the target identifier corresponding to the target data processor. When the detection result is that the changed data processor identifier is inconsistent with the target identifier, step S15 is performed.

在本发明的至少一实施例中,检测所述数据处理器IP与所述目标标识是否一致也即检测所述目标标识对应的数据处理器的本地存储中是否为最新的用户信息。当检测结果为所述变更的数据处理器标识与所述目标标识不一致时,确定所述目标标识对应的数据处理器的本地存储中存储的用户信息有待更新,执行步骤S15。当检测结果为所述变更的数据处理器标识与所述目标标识一致时,确定所述目标标识对应的数据处理器的本地存储中存储最新的用户信息。In at least one embodiment of the present invention, detecting whether the IP of the data processor is consistent with the target identifier means detecting whether the local storage of the data processor corresponding to the target identifier is the latest user information. When the detection result is that the changed data processor identifier is inconsistent with the target identifier, it is determined that the user information stored in the local storage of the data processor corresponding to the target identifier needs to be updated, and step S15 is executed. When the detection result is that the changed data processor identifier is consistent with the target identifier, it is determined that the latest user information is stored in the local storage of the data processor corresponding to the target identifier.

具体地,所述方法还包括:当检测结果为所述变更的数据处理器标识与所述目标标识一致时,确定所述目标标识对应的目标本地存储;根据所述数据查询请求查询所述目标本地存储,得到查询数据。可以理解的是,当检测结果为所述变更的数据处理器标识与所述目标标识一致时,根据所述数据查询请求查询所述本地存储,能够提高数据查询效率。Specifically, the method further includes: when the detection result is that the changed data processor identifier is consistent with the target identifier, determining the target local storage corresponding to the target identifier; querying the target according to the data query request Local storage, get query data. It can be understood that, when the detection result is that the changed data processor identifier is consistent with the target identifier, querying the local storage according to the data query request can improve data query efficiency.

S15、根据所述数据查询请求查询所述redis集群中缓存的数据,得到目标查询数据。S15. Query the data cached in the redis cluster according to the data query request to obtain target query data.

在本发明的至少一实施例中,当检测结果为所述变更的数据处理器标识与所述目标标识不一致时,此时所述redis集群中的用户热点信息为最新的。因而,调用所述目标数据处理器查询所述redis集群中缓存的数据,得到目标查询数据。其中,所述目标查询数据为与所述数据查询请求对应的数据。In at least one embodiment of the present invention, when the detection result is that the changed data processor identifier is inconsistent with the target identifier, the user hotspot information in the redis cluster is the latest at this time. Therefore, the target data processor is called to query the data cached in the redis cluster to obtain target query data. The target query data is data corresponding to the data query request.

S16、存储所述目标查询数据至对应所述目标标识的目标本地存储中。S16. Store the target query data in a target local storage corresponding to the target identifier.

在本发明的至少一实施例中,当检测结果为所述变更的数据处理器标识与所述目标标识不一致时,此时预设数据库中用户热点信息发生更新,所述数据变更记录中变更的数据处理器IP对应的本地存储及所述redis集群中的用户热点信息均已更新完成,而其他数据处理器对应的本地存储中用户热点信息并未更新完成,因而,存储所述目标查询数据至对应所述目标标识的目标本地存储中。In at least one embodiment of the present invention, when the detection result is that the changed data processor identifier is inconsistent with the target identifier, the user hotspot information in the preset database is updated at this time, and the changed data in the data change record The local storage corresponding to the data processor IP and the user hotspot information in the redis cluster have been updated, while the user hotspot information in the local storage corresponding to other data processors has not been updated. Therefore, the target query data is stored to in the target local storage corresponding to the target identifier.

在本发明的至少一实施例中,在所述存储所述目标查询数据至对应所述目标标识的目标本地存储中的步骤之后,所述方法还包括:根据所述目标标识生成目标数据变更记录;存储所述目标数据变更记录至所述redis集群中;获取所述redis集群中同一所述更新的用户信息对应的数据变更记录的数量;检测所述数据变更记录的数量与所述数据处理器的数量是否一致;当检测结果所述数据变更记录的数量与所述数据处理器的数量一致时,删除所述redis集群中同一所述更新的用户信息对应的数据变更记录。In at least one embodiment of the present invention, after the step of storing the target query data in a target local storage corresponding to the target identifier, the method further includes: generating a target data change record according to the target identifier ; Store the target data change record in the redis cluster; obtain the number of data change records corresponding to the same updated user information in the redis cluster; Detect the number of the data change records and the data processor Whether the number of data change records is consistent; when the number of data change records in the detection result is consistent with the number of data processors, delete the data change records corresponding to the same updated user information in the redis cluster.

可以理解的是,当检测结果为所述数据变更记录的数量与所述数据处理器的数量一致时,删除所述redis集群中同一所述更新的用户信息对应的数据变更记录,能够减少redis集群中关于数据变更记录的存储空间,避免浪费存储空间。It can be understood that when the detection result is that the number of data change records is consistent with the number of data processors, deleting the data change records corresponding to the same updated user information in the redis cluster can reduce the number of redis clusters. The storage space for the data change records in the system, so as to avoid wasting storage space.

在本发明的至少一实施例中,所述方法还可以包括:在预设时间间隔内,检测所述数据变更记录的数量与所述数据处理器的数量是否一致;当检测结果为所述数据变更记录的数量与所述数据处理器的数量不一致,确定对应还未进行数据更新的数据处理器的标识;输出提示至所述标识对应的数据处理器,以提示所述数据处理器及时进行数据更新。其中,所述预设时间间隔为计算机设备预先设定的,例如,所述预设时间间隔为30天。通过输出提示以提示数据处理器更新数据,能够保证多个数据处理器对应的本地存储中的信息为最新状态,从而提高了数据查询效率。In at least one embodiment of the present invention, the method may further include: within a preset time interval, detecting whether the number of the data change records is consistent with the number of the data processors; when the detection result is the data The number of change records is inconsistent with the number of the data processors, and the identifier corresponding to the data processor that has not been updated with data is determined; a prompt is output to the data processor corresponding to the identifier to prompt the data processor to perform data processing in time. renew. The preset time interval is preset by the computer device, for example, the preset time interval is 30 days. By outputting a prompt to prompt the data processor to update the data, it can ensure that the information in the local storage corresponding to the multiple data processors is in the latest state, thereby improving the data query efficiency.

本发明实施例提供的一种数据查询方法,通过本地存储与redis集群缓存相结合的方式,避免频繁地从redis集群中获取资源数据,从而提高了数据处理效率。The data query method provided by the embodiment of the present invention avoids frequently acquiring resource data from the redis cluster by combining the local storage and the redis cluster cache, thereby improving the data processing efficiency.

以上是对本发明实施例所提供的方法进行的详细描述。根据不同的需求,所示流程图中方块的执行顺序可以改变,某些方块可以省略。下面对本发明实施例所提供的计算机设备1进行描述。The above is a detailed description of the methods provided by the embodiments of the present invention. According to different requirements, the execution order of the blocks in the shown flowcharts can be changed, and some blocks can be omitted. The computer device 1 provided by the embodiment of the present invention is described below.

图2是本发明一实施方式的计算机设备的结构示意图,如图2所示,计算机设备1包括存储器10,存储器10中存储有所述数据查询装置100。所述计算机设备1可以是计算机、平板电脑、个人数字助理等具有数据处理、分析、程序执行及显示等功能的电子设备。所述数据查询装置100可以接收数据查询请求;检测redis集群中是否存在新增的数据变更记录;当检测结果为所述redis集群中存在新增的数据变更记录时,解析所述数据变更记录得到变更的数据处理器标识;检测所述变更的数据处理器标识与对应所述目标数据处理器的目标标识是否一致;当检测结果为所述变更的数据处理器标识与所述目标标识不一致时,根据所述数据查询请求查询所述redis集群中缓存的数据,得到目标查询数据;存储所述目标查询数据至对应所述目标标识的目标本地存储中。利用本发明,通过本地存储与redis集群缓存相结合的方式,避免频繁地从redis集群中获取资源数据,从而提高了数据处理效率。FIG. 2 is a schematic structural diagram of a computer device according to an embodiment of the present invention. As shown in FIG. 2 , the computer device 1 includes a memory 10 , and the data query apparatus 100 is stored in the memory 10 . The computer device 1 may be an electronic device such as a computer, a tablet computer, a personal digital assistant, etc., which has functions such as data processing, analysis, program execution, and display. The data query device 100 can receive a data query request; detect whether a new data change record exists in the redis cluster; when the detection result is that a new data change record exists in the redis cluster, parse the data change record to obtain Changed data processor identification; Detect whether the changed data processor identification is consistent with the target identification corresponding to the target data processor; when the detection result is that the changed data processor identification is inconsistent with the target identification, Query the data cached in the redis cluster according to the data query request to obtain target query data; store the target query data in the target local storage corresponding to the target identifier. Using the present invention, by combining local storage and redis cluster cache, frequent acquisition of resource data from redis cluster is avoided, thereby improving data processing efficiency.

本实施方式中,计算机设备1还可以包括显示屏20及处理器30。存储器10、显示屏20可以分别与处理器30电连接。In this embodiment, the computer device 1 may further include a display screen 20 and a processor 30 . The memory 10 and the display screen 20 may be electrically connected to the processor 30, respectively.

所述的存储器10可以是不同类型存储设备,用于存储各类数据。例如,可以是计算机设备1的存储器、内存,还可以是可外接于该计算机设备1的存储卡,如闪存、SM卡(SmartMedia Card,智能媒体卡)、SD卡(Secure Digital Card,安全数字卡)等。此外,存储器10可以包括包括非易失性存储器,例如硬盘、内存、插接式硬盘,智能存储卡(Smart MediaCard,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)、至少一个磁盘存储器件、闪存器件、或其他非易失性固态存储器件。存储器10用于存储各类数据,例如,所述计算机设备1中安装的各类应用程序(Applications)、应用上述数据查询方法而设置、获取的数据等信息。The memory 10 can be different types of storage devices for storing various types of data. For example, it can be the memory or internal memory of the computer device 1, or it can be a memory card that can be externally connected to the computer device 1, such as a flash memory, an SM card (SmartMedia Card, smart media card), an SD card (Secure Digital Card, a secure digital card). )Wait. In addition, the memory 10 may include non-volatile memory such as hard disk, internal memory, plug-in hard disk, Smart Media Card (SMC), Secure Digital (SD) card, Flash Card (Flash Card), At least one disk storage device, flash memory device, or other non-volatile solid state storage device. The memory 10 is used to store various types of data, for example, various types of application programs (Applications) installed in the computer device 1 , data set and acquired by applying the above-mentioned data query method, and other information.

显示屏20安装于计算机设备1,用于显示信息。The display screen 20 is installed in the computer device 1 for displaying information.

处理器30用于执行所述数据查询方法以及所述计算机设备1内安装的各类软件,例如操作系统及应用显示软件等。处理器30包含但不限于处理器(Central ProcessingUnit,CPU)、微控制单元(Micro Controller Unit,MCU)等用于解释计算机指令以及处理计算机软件中的数据的装置。The processor 30 is configured to execute the data query method and various types of software installed in the computer device 1 , such as an operating system and application display software. The processor 30 includes, but is not limited to, a processor (Central Processing Unit, CPU), a Micro Controller Unit (Micro Controller Unit, MCU) and other devices for interpreting computer instructions and processing data in computer software.

所述的数据查询装置100可以包括一个或多个的模块,所述一个或多个模块被存储在计算机设备1的存储器10中并被配置成由一个或多个处理器(本实施方式为一个处理器30)执行,以完成本发明实施例。参阅图3所示,所述数据查询装置100可以包括请求接收模块101、记录检测模块102、标识解析模块103、一致检测模块104、数据查询模块105以及数据存储模块106。本发明实施例所称的模块可以是完成一特定功能的程序段,比程序更适合于描述软件在处理器30中的执行过程。The data query apparatus 100 may include one or more modules, and the one or more modules are stored in the memory 10 of the computer device 1 and configured to be executed by one or more processors (in this embodiment, a The processor 30) executes to complete the embodiment of the present invention. Referring to FIG. 3 , the data query apparatus 100 may include a request receiving module 101 , a record detection module 102 , an identification parsing module 103 , a consistency detection module 104 , a data query module 105 and a data storage module 106 . A module referred to in this embodiment of the present invention may be a program segment that performs a specific function, and is more suitable for describing the execution process of software in the processor 30 than a program.

可以理解的是,对应上述数据查询方法中的各实施方式,数据查询装置100可以包括图3中所示的各功能模块中的一部分或全部,各模块的功能将在以下具体介绍。需要说明的是,以上数据查询方法的各实施方式中相同的名词、相关名词及其具体的解释说明也可以适用于以下对各模块的功能介绍。为节省篇幅及避免重复起见,在此就不再赘述。It can be understood that, corresponding to the various embodiments of the above data query method, the data query apparatus 100 may include some or all of the functional modules shown in FIG. 3 , and the functions of each module will be described in detail below. It should be noted that, the same nouns, related nouns and their specific explanations in the above embodiments of the data query method can also be applied to the following description of the functions of each module. For the sake of saving space and avoiding repetition, details are not repeated here.

请求接收模块101可以用于接收数据查询请求。The request receiving module 101 may be configured to receive a data query request.

记录检测模块102可以用于检测redis集群中是否存在新增的数据变更记录。The record detection module 102 can be used to detect whether a new data change record exists in the redis cluster.

标识解析模块103可以用于当检测结果为所述redis集群中存在新增的数据变更记录时,解析所述数据变更记录得到变更的数据处理器标识。The identifier parsing module 103 may be configured to parse the data change record to obtain the changed data processor identifier when the detection result is that a newly added data change record exists in the redis cluster.

一致检测模块104可以用于检测所述变更的数据处理器标识与对应所述目标数据处理器的目标标识是否一致。The consistency detection module 104 may be configured to detect whether the changed data processor identification is consistent with the target identification corresponding to the target data processor.

数据查询模块105可以用于当检测结果为所述变更的数据处理器标识与所述目标标识不一致时,根据所述数据查询请求查询所述redis集群中缓存的数据,得到目标查询数据。The data query module 105 may be configured to query the data cached in the redis cluster according to the data query request to obtain target query data when the detection result is that the changed data processor identifier is inconsistent with the target identifier.

数据存储模块106可以用于存储所述目标查询数据至对应所述目标标识的目标本地存储中。The data storage module 106 may be configured to store the target query data in the target local storage corresponding to the target identifier.

本发明实施例还提供一种计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器30执行时实现上述任一实施方式中的数据查询方法的步骤。An embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by the processor 30, implements the steps of the data query method in any of the foregoing embodiments.

所述数据查询装置100/计算机设备集成的模块/单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明实现上述实施方式方法中的全部或部分流程,也可以通过计算机程序来指令相关的硬件来完成,所述的计算机程序可存储于一计算机可读存储介质中,该计算机程序在被处理器30执行时,可实现上述各个方法实施例的步骤。其中,所述计算机程序包括计算机程序代码,所述计算机程序代码可以为源代码形式、对象代码形式、可执行文件或某些中间形式等。所述计算机可读存储介质可以包括:能够携带所述计算机程序代码的任何实体或装置、记录介质、U盘、移动硬盘、磁碟、光盘、计算机存储器、只读存储器(ROM,Read-Only Memory)等。If the data query apparatus 100/computer equipment integrated modules/units are implemented in the form of software functional units and sold or used as independent products, they may be stored in a computer-readable storage medium. Based on this understanding, the present invention can implement all or part of the processes in the methods of the above embodiments, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer When the program is executed by the processor 30, the steps of the foregoing method embodiments can be implemented. Wherein, the computer program includes computer program code, and the computer program code may be in the form of source code, object code, executable file or some intermediate form, and the like. The computer-readable storage medium may include: any entity or device capable of carrying the computer program code, a recording medium, a U disk, a removable hard disk, a magnetic disk, an optical disk, a computer memory, a read-only memory (ROM, Read-Only Memory) )Wait.

所称处理器30可以是中央处理单元(Central Processing Unit,CPU),还可以是其他通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等,所述处理器30是所述数据查询装置100/计算机设备1的控制中心,利用各种接口和线路连接整个数据查询装置100/计算机设备1的各个部分。The so-called processor 30 may be a central processing unit (Central Processing Unit, CPU), and may also be other general-purpose processors, digital signal processors (Digital Signal Processors, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), Field-Programmable Gate Array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The processor 30 is the control center of the data query apparatus 100/computer equipment 1, and uses various interfaces and lines to connect the entire system. Various parts of the data query apparatus 100/computer equipment 1.

所述存储器10用于存储所述计算机程序和/或模块,所述处理器30通过运行或执行存储在所述存储器10内的计算机程序和/或模块,以及调用存储在存储器10内的数据,实现所述数据查询装置100/计算机设备1的各种功能。所述存储器10可主要包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需的应用程序(比如声音播放功能、图像播放功能等)等;存储数据区可存储根据计算机设备1的使用所创建的数据等。The memory 10 is used to store the computer programs and/or modules, and the processor 30 executes or executes the computer programs and/or modules stored in the memory 10 and calls the data stored in the memory 10, Various functions of the data query apparatus 100/computer device 1 are realized. The memory 10 may mainly include a stored program area and a stored data area, wherein the stored program area may store an operating system, an application program required for at least one function (such as a sound playback function, an image playback function, etc.); the storage data area may Data and the like created according to the use of the computer device 1 are stored.

在本发明所提供的几个具体实施方式中,应该理解到,所揭露的计算机设备和方法,可以通过其它的方式实现。例如,以上所描述的系统实施方式仅仅是示意性的,例如,所述模块的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式。In the several specific embodiments provided by the present invention, it should be understood that the disclosed computer devices and methods may be implemented in other manners. For example, the system implementations described above are only illustrative. For example, the division of the modules is only a logical function division, and there may be other division manners in actual implementation.

本发明所指区块链是分布式数据存储、点对点传输、共识机制、加密算法等计算机技术的新型应用模式。区块链(Blockchain),本质上是一个去中心化的数据库,是一串使用密码学方法相关联产生的数据块,每一个数据块中包含了一批次网络交易的信息,用于验证其信息的有效性(防伪)和生成下一个区块。区块链可以包括区块链底层平台、平台产品服务层以及应用服务层等。The blockchain referred to in the present invention is a new application mode of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanism, and encryption algorithm. Blockchain, essentially a decentralized database, is a series of data blocks associated with cryptographic methods. Each data block contains a batch of network transaction information to verify its Validity of information (anti-counterfeiting) and generation of the next block. The blockchain can include the underlying platform of the blockchain, the platform product service layer, and the application service layer.

对于本领域技术人员而言,显然本发明实施例不限于上述示范性实施例的细节,而且在不背离本发明实施例的精神或基本特征的情况下,能够以其他的具体形式实现本发明实施例。因此,无论从哪一点来看,均应将实施例看作是示范性的,而且是非限制性的,本发明实施例的范围由所附权利要求而不是上述说明限定,因此旨在将落在权利要求的等同要件的含义和范围内的所有变化涵括在本发明实施例内。不应将权利要求中的任何附图标记视为限制所涉及的权利要求。系统、装置或计算机设备权利要求中陈述的多个单元、模块或装置也可以由同一个单元、模块或装置通过软件或者硬件来实现。For those skilled in the art, it is obvious that the embodiments of the present invention are not limited to the details of the above-mentioned exemplary embodiments, and the present invention can be implemented in other specific forms without departing from the spirit or essential features of the embodiments of the present invention example. Accordingly, the embodiments are to be considered in all respects as exemplary and not restrictive, the scope of the embodiments of the present invention being defined by the appended claims rather than the foregoing description, and are therefore intended to fall within the scope of All changes within the meaning and scope of equivalents of the claims are included in the embodiments of the present invention. Any reference signs in the claims shall not be construed as limiting the involved claim. Several units, modules or means recited in the system, device or computer device claims can also be realized by one and the same unit, module or means by means of software or hardware.

以上实施方式仅用以说明本发明实施例的技术方案而非限制,尽管参照以上较佳实施方式对本发明实施例进行了详细说明,本领域的普通技术人员应当理解,可以对本发明实施例的技术方案进行修改或等同替换都不应脱离本发明实施例的技术方案的精神和范围。The above embodiments are only used to illustrate the technical solutions of the embodiments of the present invention and not limit them. Although the embodiments of the present invention have been described in detail with reference to the above preferred embodiments, those of ordinary skill in the art should understand that the technical solutions of the embodiments of the present invention can be Modifications or equivalent replacements of the solutions should not depart from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims (10)

1. A data query method is applied to a target data processor, and is characterized by comprising the following steps:
receiving a data query request;
detecting whether a newly added data change record exists in a redis cluster;
when the detection result indicates that the newly added data change record exists in the redis cluster, analyzing the data change record to obtain a changed data processor identifier;
detecting whether the changed data processor identification is consistent with a target identification corresponding to the target data processor;
when the detection result is that the changed data processor identifier is inconsistent with the target identifier, querying the data cached in the redis cluster according to the data query request to obtain target query data;
and storing the target query data into a target local storage corresponding to the target identifier.
2. The data query method of claim 1, wherein prior to the receiving a data query request, the method further comprises:
acquiring the current residual resource amount;
detecting whether the current residual resource amount is larger than a preset resource amount;
and receiving a data query request when the detection result indicates that the current residual resource amount is larger than the preset resource amount.
3. The data query method of claim 1, wherein the detecting whether there is a newly added data change record in the redis cluster comprises:
detecting whether a redis cluster has data in a preset data format, and determining that a newly added data change record exists in the redis cluster when a detection result is that the redis cluster has the data in the preset data format; or
Detecting whether a preset label exists in a redis cluster, and determining that a newly added data change record exists in the redis cluster when the detection result indicates that the preset label exists in the redis cluster.
4. The data query method of claim 1, wherein after the receiving a data query request, the method further comprises:
detecting whether a preset mark exists in the redis cluster;
when the detection result indicates that the preset mark exists in the redis cluster, adding the data change record;
and when the detection result indicates that the preset mark does not exist in the redis cluster, detecting whether a newly added data change record exists in the redis cluster.
5. The data query method of claim 4, wherein the adding the data change record comprises:
inquiring a preset database, wherein the preset database is a database in a block chain, and the latest user information is stored in the preset database;
acquiring the latest user information corresponding to the preset mark;
storing the latest user information into a target local storage corresponding to the target identifier;
and storing the latest user information into the redis cluster, and generating a data change record according to the target identifier.
6. The data query method of claim 1, after storing the target query data in a target local storage corresponding to the target identifier, the method further comprising:
generating a target data change record according to the target identifier;
storing the target data change record in the redis cluster;
acquiring the number of data change records corresponding to the same updated user information in the redis cluster;
detecting whether the number of the data change records is consistent with the number of the data processors;
and deleting the data change records corresponding to the same updated user information in the redis cluster when the number of the data change records is consistent with the number of the data processors in the detection result.
7. The data query method of claim 1, further comprising:
when the detection result is that the changed data processor identifier is consistent with the target identifier, determining a target local storage corresponding to the target identifier;
and querying the target local storage according to the data query request to obtain query data.
8. A data query device for use in a target data processor, the data query device comprising:
the request receiving module is used for receiving a data query request;
the recording detection module is used for detecting whether a newly added data change record exists in the redis cluster;
the identification analysis module is used for analyzing the data change record to obtain a changed data processor identification when the detection result indicates that the newly added data change record exists in the redis cluster;
a consistency detection module for detecting whether the changed data processor identification is consistent with the target identification corresponding to the target data processor;
the data query module is used for querying the data cached in the redis cluster according to the data query request to obtain target query data when the detection result is that the changed data processor identifier is inconsistent with the target identifier;
and the data storage module is used for storing the target query data into a target local storage corresponding to the target identifier.
9. A computer device comprising a processor for implementing a data query method as claimed in any one of claims 1 to 7 when executing a computer program stored in a memory.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, implements a data query method according to any one of claims 1 to 7.
CN202010600092.2A 2020-06-28 2020-06-28 Data query method, device, computer equipment and storage medium Active CN111737303B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010600092.2A CN111737303B (en) 2020-06-28 2020-06-28 Data query method, device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010600092.2A CN111737303B (en) 2020-06-28 2020-06-28 Data query method, device, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN111737303A true CN111737303A (en) 2020-10-02
CN111737303B CN111737303B (en) 2025-03-28

Family

ID=72651464

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010600092.2A Active CN111737303B (en) 2020-06-28 2020-06-28 Data query method, device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN111737303B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113778977A (en) * 2020-10-29 2021-12-10 北京京东尚科信息技术有限公司 Data processing method and data processing device
CN114510500A (en) * 2020-11-17 2022-05-17 天翼云科技有限公司 Redis cluster query method, apparatus, computer-readable storage medium and program product
CN115687401A (en) * 2021-07-30 2023-02-03 中国联合网络通信集团有限公司 Data query method, device and computer storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107025243A (en) * 2016-02-02 2017-08-08 北京神州泰岳软件股份有限公司 A kind of querying method of resource data, inquiring client terminal and inquiry system
CN108614847A (en) * 2016-12-30 2018-10-02 北京京东尚科信息技术有限公司 A kind of caching method and system of data
CN109597915A (en) * 2018-09-18 2019-04-09 北京微播视界科技有限公司 Access request treating method and apparatus
CN110162543A (en) * 2019-05-29 2019-08-23 北京奇艺世纪科技有限公司 A kind of information query method and device
CN110909025A (en) * 2018-09-17 2020-03-24 深圳市优必选科技有限公司 Database query method, query device and terminal
US10657064B1 (en) * 2019-01-31 2020-05-19 Salesforce.com. inc. Extending usages of cached data objects beyond cache expiration periods

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107025243A (en) * 2016-02-02 2017-08-08 北京神州泰岳软件股份有限公司 A kind of querying method of resource data, inquiring client terminal and inquiry system
CN108614847A (en) * 2016-12-30 2018-10-02 北京京东尚科信息技术有限公司 A kind of caching method and system of data
CN110909025A (en) * 2018-09-17 2020-03-24 深圳市优必选科技有限公司 Database query method, query device and terminal
CN109597915A (en) * 2018-09-18 2019-04-09 北京微播视界科技有限公司 Access request treating method and apparatus
US10657064B1 (en) * 2019-01-31 2020-05-19 Salesforce.com. inc. Extending usages of cached data objects beyond cache expiration periods
CN110162543A (en) * 2019-05-29 2019-08-23 北京奇艺世纪科技有限公司 A kind of information query method and device

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113778977A (en) * 2020-10-29 2021-12-10 北京京东尚科信息技术有限公司 Data processing method and data processing device
CN114510500A (en) * 2020-11-17 2022-05-17 天翼云科技有限公司 Redis cluster query method, apparatus, computer-readable storage medium and program product
CN115687401A (en) * 2021-07-30 2023-02-03 中国联合网络通信集团有限公司 Data query method, device and computer storage medium

Also Published As

Publication number Publication date
CN111737303B (en) 2025-03-28

Similar Documents

Publication Publication Date Title
CN112380227B (en) Data synchronization method, device, equipment and storage medium based on message queue
CN111344706B (en) Method and system for managing transactions on blockchain
US10248414B2 (en) System and method for determining component version compatibility across a device ecosystem
CN109815746B (en) Data tamper-proofing method and system based on block chain technology
US11556874B2 (en) Block creation based on transaction cost and size
WO2021114406A1 (en) Blockchain-based vaccine information monitoring method and apparatus, and computer device
CN108846753B (en) Method and apparatus for processing data
US10437708B2 (en) System for refreshing and sanitizing testing data in a low-level environment
CN110121727A (en) Method and system for providing certified, auditable and immutable inputs for intelligent contracts
CN110413695A (en) Blockchain-based police information management method, device, equipment and medium
CN111737303A (en) Data query method, device, computer equipment and storage medium
US20220083507A1 (en) Trust chain for official data and documents
WO2019071899A1 (en) Electronic device, vehicle data import method and storage medium
JP2024543011A (en) Method and system for pruning blocks from a blockchain for data retention and storage scalability purposes
CN115086047B (en) Interface authentication method and device, electronic equipment and storage medium
CN112085611A (en) Asynchronous data verification method and device, electronic equipment and storage medium
CN115664772A (en) Access request processing method and device, computer equipment and storage medium
WO2021012554A1 (en) Method and apparatus for updating data field in block chain, medium, and electronic device
CN118192897A (en) Data storage system, method and device
CN111221817B (en) Service information data storage method, device, computer equipment and storage medium
WO2021114627A1 (en) Distributed transaction-based data processing method, device, terminal, and storage medium
CN111443992A (en) Docker mirror image difference derivation method, computer storage medium and electronic device
CN115438279A (en) Data visualization method, device, electronic device and medium
CN112084114B (en) Method and apparatus for testing interfaces
CN112508387B (en) Case final book examination method, device and equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant