CN112783866A - Data reading method and device, computer equipment and storage medium - Google Patents

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

Info

Publication number
CN112783866A
CN112783866A CN202110129979.2A CN202110129979A CN112783866A CN 112783866 A CN112783866 A CN 112783866A CN 202110129979 A CN202110129979 A CN 202110129979A CN 112783866 A CN112783866 A CN 112783866A
Authority
CN
China
Prior art keywords
data
version number
data type
type identifier
number corresponding
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.)
Pending
Application number
CN202110129979.2A
Other languages
Chinese (zh)
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.)
Shenzhen Zhuiyi Technology Co Ltd
Original Assignee
Shenzhen Zhuiyi Technology Co 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 Shenzhen Zhuiyi Technology Co Ltd filed Critical Shenzhen Zhuiyi Technology Co Ltd
Priority to CN202110129979.2A priority Critical patent/CN112783866A/en
Publication of CN112783866A publication Critical patent/CN112783866A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR 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/21Design, administration or maintenance of databases
    • G06F16/219Managing data history or versioning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR 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
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR 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/2458Special types of queries, e.g. statistical queries, fuzzy queries or distributed queries
    • G06F16/2474Sequence data queries, e.g. querying versioned data
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR 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/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR 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/28Databases characterised by their database models, e.g. relational or object models
    • G06F16/284Relational databases

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Fuzzy Systems (AREA)
  • Mathematical Physics (AREA)
  • Probability & Statistics with Applications (AREA)
  • Software Systems (AREA)
  • Computational Linguistics (AREA)
  • Computer Security & Cryptography (AREA)
  • Computing Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application relates to a data reading method, a data reading device, computer equipment and a storage medium. The method comprises the following steps: receiving a data reading request, and determining a data type identifier corresponding to target data to be read according to the data reading request; respectively acquiring a version number corresponding to the data type identifier stored by the application server and a version number corresponding to the data type identifier stored by the distributed cache server; and if the version number corresponding to the data type identifier stored by the application server is matched with the version number corresponding to the data type identifier stored by the distributed cache server, reading the target data from the memory of the application server. By adopting the method, the access pressure of the database can be reduced, and the data reading efficiency is improved.

Description

Data reading method and device, computer equipment and storage medium
Technical Field
The present application relates to the field of data reading technologies, and in particular, to a data reading method and apparatus, a computer device, and a storage medium.
Background
With the development of science and technology, it is a common data storage method to store data by using a database. When the terminal accesses the application server, the application server accesses the database, reads data from the database and feeds the data back to the terminal.
However, when a large number of terminals access the application server, or the terminals frequently access the application server, the application server may access the database in a large scale, which may cause a large access pressure on the database, resulting in a data reading bottleneck and a low data reading efficiency.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a data reading method, an apparatus, a computer device, and a storage medium, which can reduce the access pressure of a database and improve the data reading efficiency.
A data reading method is applied to an application server and comprises the following steps:
receiving a data reading request, and determining a data type identifier corresponding to target data to be read according to the data reading request;
respectively acquiring a version number corresponding to the data type identifier stored by the application server and a version number corresponding to the data type identifier stored by the distributed cache server;
and if the version number corresponding to the data type identifier stored by the application server is matched with the version number corresponding to the data type identifier stored by the distributed cache server, reading the target data from the memory of the application server.
In one embodiment, after the obtaining the version number corresponding to the data type identifier stored in the application server and the version number corresponding to the data type identifier stored in the distributed cache server, respectively, the method further includes:
and if the version number corresponding to the data type identifier stored by the application server is not matched with the version number corresponding to the data type identifier stored by the distributed cache server, reading the target data from the preset database and storing the target data into the memory of the application server.
In one embodiment, after the reading of the target data from the preset database, the method further includes:
and updating the version number corresponding to the data type identifier stored by the application server according to the version number corresponding to the data type identifier stored by the distributed cache server.
In one embodiment, before receiving the data read request, the method further includes:
acquiring target data from a preset database, and storing the target data into a memory of an application server;
generating a data type identifier corresponding to the target data according to the data type of the target data;
acquiring a version number corresponding to the data type identifier from a distributed cache server;
if the version number corresponding to the data type identifier does not exist in the distributed cache server, generating the version number corresponding to the data type identifier, and storing the version number corresponding to the data type identifier;
and sending the version number corresponding to the generated data type identifier to a distributed cache server for storage.
In one embodiment, after obtaining the version number corresponding to the data type identifier from the distributed cache server, the method further includes:
and if the version number corresponding to the data type identifier is obtained from the distributed cache server, storing the version number corresponding to the data type identifier.
In one embodiment, the method further comprises:
acquiring updating information;
updating the stored data in the application server and the stored data in the preset database according to the updating information;
updating the version number corresponding to the stored data in the application server to obtain a new version number;
and updating the version number stored in the distributed cache server according to the new version number.
In one embodiment, the determining, according to the data reading request, the data type identifier corresponding to the target data to be read includes:
determining target data according to the data reading request;
and determining the data type of the target data, and generating a data type identifier according to the data type.
A data reading device is applied to an application server, and the device comprises:
the request receiving module is used for receiving a data reading request and determining a data type identifier corresponding to target data to be read according to the data reading request;
the first version number acquisition module is used for respectively acquiring the version number corresponding to the data type identifier stored by the application server and the version number corresponding to the data type identifier stored by the distributed cache server;
and the first data reading module is used for reading the target data from the memory of the application server if the version number corresponding to the data type identifier stored by the application server is matched with the version number corresponding to the data type identifier stored by the distributed cache server.
In one embodiment, the apparatus further comprises:
and the second data reading module is used for reading the target data from the preset database and storing the target data into the memory of the application server if the version number corresponding to the data type identifier stored by the application server is not matched with the version number corresponding to the data type identifier stored by the distributed cache server.
In one embodiment, the apparatus further comprises:
and the first version number updating module is used for updating the version number corresponding to the data type identifier stored by the application server according to the version number corresponding to the data type identifier stored by the distributed cache server.
In one embodiment, the apparatus further comprises:
the data acquisition module is used for acquiring target data from a preset database and storing the target data into a memory of the application server;
the identification generation module is used for generating a data type identification corresponding to the target data according to the data type of the target data;
the second version number obtaining module is used for obtaining a version number corresponding to the data type identifier from the distributed cache server;
the version number generation module is used for generating a version number corresponding to the data type identifier and storing the version number corresponding to the data type identifier if the version number corresponding to the data type identifier does not exist in the distributed cache server;
and the version number sending module is used for sending the version number corresponding to the generated data type identifier to the distributed cache server for storage.
In one embodiment, the apparatus further comprises:
and the version number storage module is used for storing the version number corresponding to the data type identifier if the version number corresponding to the data type identifier is obtained from the distributed cache server.
In one embodiment, the apparatus further comprises:
the information acquisition module is used for acquiring the updating information;
the data updating module is used for updating the stored data in the application server and the stored data in the preset database according to the updating information;
the second version number updating module is used for updating the version number corresponding to the stored data in the application server to obtain a new version number;
and the third version number updating module is used for updating the version number stored in the distributed cache server according to the new version number.
In one embodiment, the request receiving module is specifically configured to determine target data according to a data reading request; and determining the data type of the target data, and generating a data type identifier according to the data type.
A computer device comprising a memory and a processor, the memory storing a computer program, the processor implementing the following steps when executing the computer program:
receiving a data reading request, and determining a data type identifier corresponding to target data to be read according to the data reading request;
respectively acquiring a version number corresponding to the data type identifier stored by the application server and a version number corresponding to the data type identifier stored by the distributed cache server;
and if the version number corresponding to the data type identifier stored by the application server is matched with the version number corresponding to the data type identifier stored by the distributed cache server, reading the target data from the memory of the application server.
A computer-readable storage medium, on which a computer program is stored which, when executed by a processor, carries out the steps of:
receiving a data reading request, and determining a data type identifier corresponding to target data to be read according to the data reading request;
respectively acquiring a version number corresponding to the data type identifier stored by the application server and a version number corresponding to the data type identifier stored by the distributed cache server;
and if the version number corresponding to the data type identifier stored by the application server is matched with the version number corresponding to the data type identifier stored by the distributed cache server, reading the target data from the memory of the application server.
The data reading method, the data reading device, the computer equipment and the storage medium receive the data reading request, and determine the data type identification corresponding to the target data to be read according to the data reading request; respectively acquiring a version number corresponding to the data type identifier stored by the application server and a version number corresponding to the data type identifier stored by the distributed cache server; and if the version number corresponding to the data type identifier stored by the application server is matched with the version number corresponding to the data type identifier stored by the distributed cache server, reading the target data from the memory of the application server. In the embodiment of the disclosure, the application server and the distributed cache server respectively store version numbers, and if it is determined through comparison of the version numbers that the data preloaded in the application server is consistent with the data in the preset database, the data is directly read from the memory of the application server.
Drawings
FIG. 1 is a diagram of an exemplary data reading method;
FIG. 2 is a flow chart illustrating a data reading method according to an embodiment;
FIG. 3 is a second flowchart illustrating a data reading method according to an embodiment;
FIG. 4 is a flowchart illustrating the steps of obtaining data and version numbers in one embodiment;
FIG. 5 is a flowchart illustrating the steps of updating data and version numbers in one embodiment;
FIG. 6 is a block diagram showing the structure of a data reading apparatus according to an embodiment;
FIG. 7 is a diagram illustrating an internal structure of a computer device according to an embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
The data reading method provided by the application can be applied to the application environment shown in fig. 1. The application environment comprises a terminal 101, an application server 102 and a distributed cache server 103; wherein, the application server 102 communicates with the terminal 101 and the distributed cache server 103 through a network. The terminal 101 may be, but is not limited to, various personal computers, notebook computers, smart phones, tablet computers, and portable wearable devices; the application server 102 and the distributed cache server 103 may be implemented by separate servers or a server cluster composed of a plurality of servers.
In one embodiment, as shown in fig. 2, a data reading method is provided, which is described by taking the application server in fig. 1 as an example, and includes the following steps:
step 201, receiving a data reading request, and determining a data type identifier corresponding to target data to be read according to the data reading request.
The data reading request indicates target data to be read. The target data includes at least one of basic data and hot spot data.
When the terminal runs the application program, a data reading request is sent to the application server, and data is read from the application server. The application server receives a data reading request sent by the terminal and determines target data according to the data reading request; and determining the data type of the target data, and generating a data type identifier according to the data type.
For example, the application server receives a data reading request sent by the terminal, the data reading request indicates that target data to be read is hot data a, the application server determines a data type of the hot data a, determines a key value according to the data type, and uses the key value as a data type identifier. The key value may be determined by generating the key value from the data type according to a preset generation rule, or by searching for the key value corresponding to the data type according to a preset correspondence, which is not limited in the embodiment of the present disclosure.
Step 202, respectively obtaining a version number corresponding to the data type identifier stored by the application server and a version number corresponding to the data type identifier stored by the distributed cache server.
The application server may pre-store a plurality of data type identifiers and version numbers corresponding to the data type identifiers, and the distributed cache server also pre-stores a plurality of data type identifiers and version numbers corresponding to the data type identifiers. After determining the data type identifier corresponding to the target data, the application server obtains the version number corresponding to the data type identifier from the application server, and obtains the version number corresponding to the data type identifier from the distributed cache server.
For example, the application server identifies key1 according to the data type, the version number corresponding to the key1 obtained from the local is 1.1, and the version number corresponding to the key1 obtained from the distributed cache server is 1.1. The version number may also be in other formats, which is not limited in this disclosure.
In step 203, if the version number corresponding to the data type identifier stored in the application server matches the version number corresponding to the data type identifier stored in the distributed cache server, the target data is read from the memory of the application server.
The application server loads data from a preset database in advance and stores the data in a memory of the application server. And after the locally stored version number and the version number stored by the distributed cache server are obtained, the application server compares the two version numbers. And if the two version numbers are matched, the data stored in the memory of the application server is consistent with the data stored in the preset database. At this time, the application server may read the target data from the memory without querying the target data from the preset database. And after reading the target data from the memory, the application server feeds back the target data to the terminal sending the data reading request.
For example, the application server obtains that the locally stored version number is 1.1, the version number stored by the distributed cache server is 1.1, compares the two version numbers, and determines that the two version numbers are matched, so that the application server reads the target data from the memory and feeds back the target data.
In the data reading method, a data reading request is received, and a data type identifier corresponding to target data to be read is determined according to the data reading request; respectively acquiring a version number corresponding to the data type identifier stored by the application server and a version number corresponding to the data type identifier stored by the distributed cache server; and if the version number corresponding to the data type identifier stored by the application server is matched with the version number corresponding to the data type identifier stored by the distributed cache server, reading the target data from the memory of the application server. In the embodiment of the disclosure, the application server and the distributed cache server respectively store version numbers, and if it is determined through comparison of the version numbers that the data preloaded in the application server is consistent with the data in the preset database, the data is directly read from the memory of the application server without accessing the preset database, so that the access pressure of the database can be reduced, and the data reading efficiency can be improved.
In an embodiment, as shown in fig. 3, after obtaining a version number corresponding to the data type identifier stored in the application server and a version number corresponding to the data type identifier stored in the distributed cache server, respectively, the embodiment of the present disclosure may further include the following steps:
in step 204, if the version number corresponding to the data type identifier stored in the application server does not match the version number corresponding to the data type identifier stored in the distributed cache server, reading the target data from the preset database, and storing the target data in the memory of the application server.
After the application server obtains the version number stored locally and the version number stored in the distributed cache server, the two version numbers are compared, if the two version numbers are not matched, the data stored in the memory of the application server is inconsistent with the data stored in the preset database, the data stored in the preset database is changed, and the version number stored in the distributed cache server is the latest version number. Therefore, the application server does not read the target data from the memory, but reads the target data from the preset database. And then, the application server stores the target data into the memory, so that the data stored in the memory of the application server is consistent with the data stored in the preset database, and errors in the data fed back to the terminal are avoided.
For example, the version number obtained by the application server and stored locally is 1.1, the version number stored by the distributed cache server is 2.1, the application server compares the two version numbers, and if the two version numbers are determined not to match, the target data is read from the preset database.
And step 205, updating the version number corresponding to the data type identifier stored in the application server according to the version number corresponding to the data type identifier stored in the distributed cache server.
Because the version number stored in the distributed cache server is the latest version number, after the target data is read from the preset database and stored in the memory, the application server updates the locally stored version number according to the version number stored in the distributed cache server.
For example, the version number stored locally by the application server is 1.1, the version number stored by the distributed cache server is 2.1, and after the target data is read from the preset database and stored in the memory, the version number stored locally by the application server is updated to 2.1.
In the above embodiment, if the version number corresponding to the data type identifier stored in the application server does not match the version number corresponding to the data type identifier stored in the distributed cache server, the target data is read from the preset database, and the target data is stored in the memory of the application server; and updating the version number corresponding to the data type identifier stored by the application server according to the version number corresponding to the data type identifier stored by the distributed cache server. In the embodiment of the disclosure, the application server and the distributed cache server respectively store version numbers, and if it is determined through comparison of the version numbers that the data preloaded in the application server is inconsistent with the data in the preset database, the data is read from the preset database, and the version number is updated, so as to ensure that the version number can reflect whether the data stored in the application server is consistent with the data stored in the preset database.
In one embodiment, as shown in fig. 4, before receiving the data read request, the following steps may be further included:
step 301, obtaining target data from a preset database, and storing the target data in a memory of an application server.
After the application server is started, target data are obtained from a preset database and stored in a memory. For example, the application server obtains the basic data and the hot spot data from a preset database, and stores the basic data and the hot spot data in the memory.
Step 302, generating a data type identifier corresponding to the target data according to the data type of the target data.
The application server determines the data type of the target data and generates a data type identifier corresponding to the data type according to a preset rule; or searching a data type identifier corresponding to the data type according to a preset corresponding relation. The embodiment of the present disclosure does not limit the generation manner of the data type identifier.
Step 303, obtaining a version number corresponding to the data type identifier from the distributed cache server.
And the application server sends a version number acquisition request to the distributed cache server, and the distributed cache server receives the version number acquisition request. And the distributed cache server acquires the corresponding version number according to the data type identifier carried in the version number acquisition request. If the version number corresponding to the data type identifier does not exist in the distributed cache server, executing step 304; if the distributed cache server obtains the version number corresponding to the data type identifier, step 306 is executed.
Step 304, if the version number corresponding to the data type identifier does not exist in the distributed cache server, generating a version number corresponding to the data type identifier, and storing the version number corresponding to the data type identifier.
And if the version number corresponding to the data type identifier does not exist in the distributed cache server, the distributed cache server feeds back the version number to the application server to acquire failure information. And the application server receives the version number acquisition failure information fed back by the server, determines that the version number corresponding to the data type identifier does not exist in the distributed cache server according to the version number acquisition failure information, further generates the version number corresponding to the data type identifier and stores the version number.
And 305, sending the version number corresponding to the generated data type identifier to a distributed cache server for storage.
After the application server generates the version number, the version number is not only stored locally, but also sent to the distributed cache server for storage, so that the application server can acquire the version number from the distributed cache server next time.
Step 306, if the version number corresponding to the data type identifier is obtained from the distributed cache server, the version number corresponding to the data type identifier is stored.
And if the distributed cache server obtains the version number corresponding to the data type identifier, sending the version number corresponding to the data type identifier to the application server. And the application server receives the version number corresponding to the data type identifier sent by the distributed cache server and stores the version number corresponding to the data type identifier, so that the version number stored by the application server and the version number stored by the distributed cache server can be compared in the following process.
In the embodiment, the target data is obtained from the preset database and is stored in the memory of the application server; generating a data type identifier corresponding to the target data according to the data type of the target data; acquiring a version number corresponding to the data type identifier from a distributed cache server; if the version number corresponding to the data type identifier does not exist in the distributed cache server, generating the version number corresponding to the data type identifier, and storing the version number corresponding to the data type identifier; sending the version number corresponding to the generated data type identifier to a distributed cache server for storage; and if the version number corresponding to the data type identifier is obtained from the distributed cache server, storing the version number corresponding to the data type identifier. In the embodiment of the disclosure, the application server loads data in advance, acquires or generates the version number, and prepares for data reading, so that data can be read from the application server locally in the following process according to the version number, thereby improving the data reading efficiency and reducing the access pressure of the database.
In an embodiment, as shown in fig. 5, on the basis of the above embodiment, an embodiment of the present disclosure may further include:
step 401, update information is obtained.
When the terminal runs the application program, the data of the application program may be modified, and after the modification, the terminal generates update information according to the modified content and sends the update information to the application server. And the application server receives the updating information sent by the terminal.
And 402, updating the stored data in the application server and the stored data in the preset database according to the updating information.
And after receiving the updating information, the application server updates the stored data in the memory. And meanwhile, sending the updating information to a preset database, and updating the stored data in the preset database.
Step 403, updating the version number corresponding to the data stored in the application server to obtain a new version number.
And after the application server updates the stored data in the memory, the version number of the data is also updated to obtain a new version number. For example, the version number of the stored data X is 2.1, and after the stored data X is updated according to the update information, the application server updates the version number of the stored data X to obtain a new version number of 3.1.
And step 404, updating the version number stored in the distributed cache server according to the new version number.
And after obtaining the new version number, the application server sends the new version number to the distributed cache server. And the distributed cache server updates the stored version number according to the new version number so as to ensure that the version number stored by the application server is consistent with the version number stored by the distributed cache server after the data is updated.
In the above embodiment, the application server obtains the update information; updating the stored data in the application server and the stored data in the preset database according to the updating information; updating the version number corresponding to the stored data in the application server to obtain a new version number; and updating the version number stored in the distributed cache server according to the new version number. In the embodiment of the disclosure, after the update information is acquired, the application server updates the data of both the local database and the preset database, so as to ensure that the data stored in the preset database is the latest data; and the application server also updates the version numbers stored in the local cache server and the distributed cache server, so that the version numbers stored in the distributed cache server are the latest version numbers. Thus, the application server can be ensured to read the latest and correct data.
It should be understood that, although the steps in the flowcharts of fig. 2 to 5 are shown in sequence as indicated by the arrows, the steps are not necessarily performed in sequence as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least some of the steps in fig. 2 to 5 may include multiple steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of performing the steps or stages is not necessarily sequential, but may be performed alternately or alternately with other steps or at least some of the other steps or stages.
In one embodiment, as shown in fig. 6, there is provided a data reading apparatus including:
a request receiving module 501, configured to receive a data reading request, and determine, according to the data reading request, a data type identifier corresponding to target data to be read;
a first version number obtaining module 502, configured to obtain a version number corresponding to the data type identifier stored in the application server and a version number corresponding to the data type identifier stored in the distributed cache server, respectively;
the first data reading module 503 is configured to read target data from a memory of the application server if a version number corresponding to the data type identifier stored in the application server matches a version number corresponding to the data type identifier stored in the distributed cache server.
In one embodiment, the apparatus further comprises:
and the second data reading module is used for reading the target data from the preset database and storing the target data into the memory of the application server if the version number corresponding to the data type identifier stored by the application server is not matched with the version number corresponding to the data type identifier stored by the distributed cache server.
In one embodiment, the apparatus further comprises:
and the first version number updating module is used for updating the version number corresponding to the data type identifier stored by the application server according to the version number corresponding to the data type identifier stored by the distributed cache server.
In one embodiment, the apparatus further comprises:
the data acquisition module is used for acquiring target data from a preset database and storing the target data into a memory of the application server;
the identification generation module is used for generating a data type identification corresponding to the target data according to the data type of the target data;
the second version number obtaining module is used for obtaining a version number corresponding to the data type identifier from the distributed cache server;
the version number generation module is used for generating a version number corresponding to the data type identifier and storing the version number corresponding to the data type identifier if the version number corresponding to the data type identifier does not exist in the distributed cache server;
and the version number sending module is used for sending the version number corresponding to the generated data type identifier to the distributed cache server for storage.
In one embodiment, the apparatus further comprises:
and the version number storage module is used for storing the version number corresponding to the data type identifier if the version number corresponding to the data type identifier is obtained from the distributed cache server.
In one embodiment, the apparatus further comprises:
the information acquisition module is used for acquiring the updating information;
the data updating module is used for updating the stored data in the application server and the stored data in the preset database according to the updating information;
the second version number updating module is used for updating the version number corresponding to the stored data in the application server to obtain a new version number;
and the third version number updating module is used for updating the version number stored in the distributed cache server according to the new version number.
In one embodiment, the request receiving module 501 is specifically configured to determine target data according to a data reading request; and determining the data type of the target data, and generating a data type identifier according to the data type.
For specific limitations of the data reading apparatus, reference may be made to the above limitations of the data reading method, which is not described herein again. The modules in the data reading device can be wholly or partially implemented by software, hardware and a combination thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
In one embodiment, a computer device is provided, which may be a server, the internal structure of which may be as shown in fig. 7. The computer device includes a processor, a memory, and a network interface connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The database of the computer device is used for storing data reading data. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a data reading method.
Those skilled in the art will appreciate that the architecture shown in fig. 7 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, a computer device is provided, comprising a memory and a processor, the memory having a computer program stored therein, the processor implementing the following steps when executing the computer program:
receiving a data reading request, and determining a data type identifier corresponding to target data to be read according to the data reading request;
respectively acquiring a version number corresponding to the data type identifier stored by the application server and a version number corresponding to the data type identifier stored by the distributed cache server;
and if the version number corresponding to the data type identifier stored by the application server is matched with the version number corresponding to the data type identifier stored by the distributed cache server, reading the target data from the memory of the application server.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
and if the version number corresponding to the data type identifier stored by the application server is not matched with the version number corresponding to the data type identifier stored by the distributed cache server, reading the target data from the preset database and storing the target data into the memory of the application server.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
and updating the version number corresponding to the data type identifier stored by the application server according to the version number corresponding to the data type identifier stored by the distributed cache server.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
acquiring target data from a preset database, and storing the target data into a memory of an application server;
generating a data type identifier corresponding to the target data according to the data type of the target data;
acquiring a version number corresponding to the data type identifier from a distributed cache server;
if the version number corresponding to the data type identifier does not exist in the distributed cache server, generating the version number corresponding to the data type identifier, and storing the version number corresponding to the data type identifier;
and sending the version number corresponding to the generated data type identifier to a distributed cache server for storage.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
and if the version number corresponding to the data type identifier is obtained from the distributed cache server, storing the version number corresponding to the data type identifier.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
acquiring updating information;
updating the stored data in the application server and the stored data in the preset database according to the updating information;
updating the version number corresponding to the stored data in the application server to obtain a new version number;
and updating the version number stored in the distributed cache server according to the new version number.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
determining target data according to the data reading request;
and determining the data type of the target data, and generating a data type identifier according to the data type.
In one embodiment, a computer-readable storage medium is provided, having a computer program stored thereon, which when executed by a processor, performs the steps of:
receiving a data reading request, and determining a data type identifier corresponding to target data to be read according to the data reading request;
respectively acquiring a version number corresponding to the data type identifier stored by the application server and a version number corresponding to the data type identifier stored by the distributed cache server;
and if the version number corresponding to the data type identifier stored by the application server is matched with the version number corresponding to the data type identifier stored by the distributed cache server, reading the target data from the memory of the application server.
In one embodiment, the computer program when executed by the processor further performs the steps of:
and if the version number corresponding to the data type identifier stored by the application server is not matched with the version number corresponding to the data type identifier stored by the distributed cache server, reading the target data from the preset database and storing the target data into the memory of the application server.
In one embodiment, the computer program when executed by the processor further performs the steps of:
and updating the version number corresponding to the data type identifier stored by the application server according to the version number corresponding to the data type identifier stored by the distributed cache server.
In one embodiment, the computer program when executed by the processor further performs the steps of:
acquiring target data from a preset database, and storing the target data into a memory of an application server;
generating a data type identifier corresponding to the target data according to the data type of the target data;
acquiring a version number corresponding to the data type identifier from a distributed cache server;
if the version number corresponding to the data type identifier does not exist in the distributed cache server, generating the version number corresponding to the data type identifier, and storing the version number corresponding to the data type identifier;
and sending the version number corresponding to the generated data type identifier to a distributed cache server for storage.
In one embodiment, the computer program when executed by the processor further performs the steps of:
and if the version number corresponding to the data type identifier is obtained from the distributed cache server, storing the version number corresponding to the data type identifier.
In one embodiment, the computer program when executed by the processor further performs the steps of:
acquiring updating information;
updating the stored data in the application server and the stored data in the preset database according to the updating information;
updating the version number corresponding to the stored data in the application server to obtain a new version number;
and updating the version number stored in the distributed cache server according to the new version number.
In one embodiment, the computer program when executed by the processor further performs the steps of:
determining target data according to the data reading request;
and determining the data type of the target data, and generating a data type identifier according to the data type.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, database or other medium used in the embodiments provided herein can include at least one of non-volatile and volatile memory. Non-volatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical storage, or the like. Volatile Memory can include Random Access Memory (RAM) or external cache Memory. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM), among others.
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (10)

1. A data reading method is applied to an application server, and the method comprises the following steps:
receiving a data reading request, and determining a data type identifier corresponding to target data to be read according to the data reading request;
respectively acquiring a version number corresponding to the data type identifier stored by the application server and a version number corresponding to the data type identifier stored by the distributed cache server;
and if the version number corresponding to the data type identifier stored by the application server is matched with the version number corresponding to the data type identifier stored by the distributed cache server, reading the target data from the memory of the application server.
2. The method according to claim 1, wherein after the obtaining of the version number corresponding to the data type identifier stored by the application server and the version number corresponding to the data type identifier stored by the distributed cache server, respectively, the method further comprises:
and if the version number corresponding to the data type identifier stored by the application server is not matched with the version number corresponding to the data type identifier stored by the distributed cache server, reading the target data from a preset database, and storing the target data into a memory of the application server.
3. The method of claim 2, wherein after the reading the target data from the preset database, the method further comprises:
and updating the version number corresponding to the data type identifier stored by the application server according to the version number corresponding to the data type identifier stored by the distributed cache server.
4. The method of claim 1, wherein prior to said receiving a data read request, the method further comprises:
acquiring the target data from a preset database, and storing the target data into a memory of the application server;
generating a data type identifier corresponding to the target data according to the data type of the target data;
acquiring a version number corresponding to the data type identifier from the distributed cache server;
if the version number corresponding to the data type identifier does not exist in the distributed cache server, generating the version number corresponding to the data type identifier, and storing the version number corresponding to the data type identifier;
and sending the generated version number corresponding to the data type identifier to the distributed cache server for storage.
5. The method of claim 4, wherein after the obtaining the version number corresponding to the data type identifier from the distributed cache server, the method further comprises:
and if the version number corresponding to the data type identifier is obtained from the distributed cache server, storing the version number corresponding to the data type identifier.
6. The method of claim 1, further comprising:
acquiring updating information;
updating the stored data in the application server and the stored data in a preset database according to the updating information;
updating the version number corresponding to the stored data in the application server to obtain a new version number;
and updating the version number stored in the distributed cache server according to the new version number.
7. The method according to any one of claims 1 to 6, wherein the determining, according to the data reading request, the data type identifier corresponding to the target data to be read includes:
determining the target data according to the data reading request;
and determining the data type of the target data, and generating the data type identification according to the data type.
8. A data reading apparatus, applied to an application server, the apparatus comprising:
the request receiving module is used for receiving a data reading request and determining a data type identifier corresponding to target data to be read according to the data reading request;
a first version number obtaining module, configured to obtain a version number corresponding to the data type identifier stored in the application server and a version number corresponding to the data type identifier stored in the distributed cache server, respectively;
a first data reading module, configured to read the target data from the memory of the application server if the version number corresponding to the data type identifier stored by the application server matches the version number corresponding to the data type identifier stored by the distributed cache server.
9. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor, when executing the computer program, implements the steps of the method of any of claims 1 to 7.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 7.
CN202110129979.2A 2021-01-29 2021-01-29 Data reading method and device, computer equipment and storage medium Pending CN112783866A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110129979.2A CN112783866A (en) 2021-01-29 2021-01-29 Data reading method and device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110129979.2A CN112783866A (en) 2021-01-29 2021-01-29 Data reading method and device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN112783866A true CN112783866A (en) 2021-05-11

Family

ID=75759989

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110129979.2A Pending CN112783866A (en) 2021-01-29 2021-01-29 Data reading method and device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112783866A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113343088A (en) * 2021-06-09 2021-09-03 北京奇艺世纪科技有限公司 Data processing method, system, device, equipment and storage medium

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103514173A (en) * 2012-06-20 2014-01-15 华为技术有限公司 Data processing method and node equipment
WO2017084563A1 (en) * 2015-11-19 2017-05-26 华为技术有限公司 Distributed system-based file reading method and device
CN107066467A (en) * 2015-11-24 2017-08-18 Sap欧洲公司 Atom observability for affairs cache invalidation switches
WO2018121456A1 (en) * 2016-12-29 2018-07-05 华为技术有限公司 Data storage method, server and storage system
US20180204563A1 (en) * 2015-09-16 2018-07-19 Guangzhou Ucweb Computer Technology Co., Ltd. Method for reading webpage information by speech, browser client, and server
CN108920573A (en) * 2018-06-22 2018-11-30 北京奇艺世纪科技有限公司 A kind of data buffer storage processing method, device and terminal device
CN109582684A (en) * 2018-11-30 2019-04-05 深圳市盟天科技有限公司 A kind of update method of local cache data, device, server and storage medium
CN110555001A (en) * 2019-09-05 2019-12-10 腾讯科技(深圳)有限公司 data processing method, device, terminal and medium
CN111159233A (en) * 2019-12-18 2020-05-15 金蝶软件(中国)有限公司 Distributed caching method, system, computer device and storage medium
CN112100537A (en) * 2020-07-28 2020-12-18 苏宁云计算有限公司 Data acquisition method and application server based on local cache and distributed cache

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103514173A (en) * 2012-06-20 2014-01-15 华为技术有限公司 Data processing method and node equipment
US20180204563A1 (en) * 2015-09-16 2018-07-19 Guangzhou Ucweb Computer Technology Co., Ltd. Method for reading webpage information by speech, browser client, and server
WO2017084563A1 (en) * 2015-11-19 2017-05-26 华为技术有限公司 Distributed system-based file reading method and device
CN107066467A (en) * 2015-11-24 2017-08-18 Sap欧洲公司 Atom observability for affairs cache invalidation switches
WO2018121456A1 (en) * 2016-12-29 2018-07-05 华为技术有限公司 Data storage method, server and storage system
CN108920573A (en) * 2018-06-22 2018-11-30 北京奇艺世纪科技有限公司 A kind of data buffer storage processing method, device and terminal device
CN109582684A (en) * 2018-11-30 2019-04-05 深圳市盟天科技有限公司 A kind of update method of local cache data, device, server and storage medium
CN110555001A (en) * 2019-09-05 2019-12-10 腾讯科技(深圳)有限公司 data processing method, device, terminal and medium
CN111159233A (en) * 2019-12-18 2020-05-15 金蝶软件(中国)有限公司 Distributed caching method, system, computer device and storage medium
CN112100537A (en) * 2020-07-28 2020-12-18 苏宁云计算有限公司 Data acquisition method and application server based on local cache and distributed cache

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113343088A (en) * 2021-06-09 2021-09-03 北京奇艺世纪科技有限公司 Data processing method, system, device, equipment and storage medium

Similar Documents

Publication Publication Date Title
CN109474578B (en) Message checking method, device, computer equipment and storage medium
CN111245548A (en) Data synchronization method and device based on timestamp and computer equipment
CN111143462A (en) Data export method and device, computer equipment and storage medium
CN110489421B (en) Data storage method, apparatus, computer readable storage medium and computer device
CN110555041A (en) Data processing method, data processing device, computer equipment and storage medium
CN110866198A (en) Static resource caching method, system, device, computer equipment and storage medium
CN110781214A (en) Database reading and writing method and device, computer equipment and storage medium
CN112099979B (en) Access control method, device, computer equipment and storage medium
CN109144487B (en) Method, device, computer equipment and storage medium for developing business of parts
CN110795171B (en) Service data processing method, device, computer equipment and storage medium
CN110213392B (en) Data distribution method and device, computer equipment and storage medium
CN111400246B (en) Asynchronous file import method, device, computer equipment and storage medium
CN111414379A (en) Serial number generation method, device, equipment and computer readable storage medium
CN108512948B (en) Address book updating method and device, computer equipment and storage medium
CN112100152A (en) Service data processing method, system, server and readable storage medium
CN109462661B (en) Data synchronization method and device, computer equipment and storage medium
CN109542962B (en) Data processing method, data processing device, computer equipment and storage medium
CN109101232B (en) Method, device, computer equipment and storage medium for product development
CN108389124B (en) Data processing method, data processing device, computer equipment and storage medium
CN113886496A (en) Data synchronization method and device of block chain, computer equipment and storage medium
CN114003432A (en) Parameter checking method and device, computer equipment and storage medium
CN112783866A (en) Data reading method and device, computer equipment and storage medium
CN110765125B (en) Method and device for storing data
CN116010926A (en) Login authentication method, login authentication device, computer equipment and storage medium
CN112800123B (en) Data processing method, device, computer equipment and storage medium

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