A data reading method, device and electronic equipment

CN115964395BActive Publication Date: 2026-08-28SHENZHEN INTELLIFUSION TECHNOLOGIES CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202211738829.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-30
Publication Date
2026-08-28
Estimated Expiration
2042-12-30

AI Technical Summary

Technical Problem

[0005]本发明实施方式的目的在于解决现有技术中数据读取时间长,系统接口改动操作复杂的技术问题,提供一种数据读取方法、装置及电子设备,实现缩短数据读取时间,降低系统修改和维护成本的技术效果

Benefits of technology

[0045]上述说明仅是本发明技术方案的概述,为了能够更清楚了解本发明的技术手段,而可依照说明书的内容予以实施,并且为了让本发明的上述和其它目的、特征和优点能够更明显易懂,以下特举本发明的具体实施方式。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115964395B_ABST
    Figure CN115964395B_ABST
Patent Text Reader

Abstract

The application relates to a data reading method, device and electronic equipment. First cache is constructed according to first identification information; target page code identification of requested data is acquired, and it is checked whether the target page code identification exists in the first cache; if not, the first cache is updated, and the requested data is acquired in a first mode; if yes, the requested data is read from the first cache; wherein the first identification information is related to a data request user, when the first cache is constructed, the first cache stores data with the highest priority corresponding to the first identification information, and after the first cache is updated, the first cache stores data corresponding to the target page code identification. The target data to be read is pre-stored in the first cache, the frequency of directly reading data from a database is reduced, the target data is searched and read in the first cache with small space, and the data reading time is greatly shortened, and the data reading efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to the field of data storage and processing, and particularly to a data reading method, apparatus and electronic device. Background Technology

[0002] During system use, it is often necessary to retrieve massive amounts of data from external sources to assist decision-making and maintain normal system operation. Traditionally, when the amount of data required is small, existing technologies offer pagination to retrieve data from the database, skipping pages based on page number and the amount of data per page. However, as the system becomes more widely used, the amount of data to be retrieved increases continuously. Using traditional pagination to search for specific page numbers in an unordered database significantly increases query time, leading to increasingly slower data retrieval, longer user wait times, a poor user experience, and severely impacting the timeliness of data acquisition and processing.

[0003] Some existing technologies have improved the way data is stored in databases. However, such improvements require modification to both the system's data retrieval request content and the database's query method. This necessitates changes to the system's interface, resulting in high system maintenance costs and complex system modification operations.

[0004] Therefore, there is an urgent need for a data reading method, device, and electronic device that can shorten data reading time without modifying the system interface. Summary of the Invention

[0005] The purpose of this invention is to solve the technical problems of long data reading time and complex system interface modification in the prior art, and to provide a data reading method, device and electronic device to achieve the technical effect of shortening data reading time and reducing system modification and maintenance costs.

[0006] To address the aforementioned technical problems, embodiments of the present invention provide a data reading method, comprising:

[0007] Construct a first cache based on the first identifier information;

[0008] Obtain the target page number identifier of the requested data, and check whether the target page number identifier exists in the first cache;

[0009] If it does not exist, update the first cache and retrieve the requested data using the first method;

[0010] If it exists, read the requested data from the first cache;

[0011] The first identification information is related to the data requesting user. When the first cache is constructed, the first cache stores the data with the highest priority corresponding to the first identification information. After the first cache is updated, the first cache stores the data corresponding to the target page number identifier.

[0012] Preferably, the first identification information includes at least a user identifier.

[0013] The step of constructing the first cache based on the first identifier information specifically includes:

[0014] The system statistically analyzes the data requested by the user corresponding to the user identifier within the first historical time period, obtains the importance of the historical access data, extracts the first data that is consistent with the data type of the historical access data with the highest importance, and caches the first data in the first cache to construct the first cache.

[0015] Preferably, the first historical time period is the time period from the current data request.

[0016] The importance of historical access data includes: evaluating the importance based on the first attribute information of the historical access data, which includes the frequency of data access, the type of data accessed, and the time of the most recent access before the current data request.

[0017] After determining the importance of historical access data, the historical access data is sorted from highest to lowest importance in order to extract the first data that has the same data type as the historical access data with the highest importance.

[0018] Preferably, after extracting the first data with the same data type as the historical access data with the highest importance and caching the first data in the first cache, the method further includes: determining whether the first cache is full; if the first cache still has free space, storing the data with the highest importance ranking according to the ranking result of the historical access data into the first cache in sequence, until the first cache is full.

[0019] Preferably, the first method is a page-skipping method. If the cache does not exist, the first cache is updated, and the requested data is obtained using the first method, specifically including:

[0020] The original data in the first cache is deleted. The data segment is located in the database using the first method, the target page number identifier, and the requested data volume. The first target data of the data segment is read and returned to the requester. The data in the data segment other than the first target data is cached in the first cache to update the first cache. The first target data is a part of the data segment.

[0021] Preferably, caching the data in the data segment other than the first target data into the first cache specifically includes:

[0022] Calculate the space required for the data in the data segment excluding the first target data and the free space of the first cache;

[0023] If the required space is less than or equal to the free space of the first cache, the data in the data segment other than the first target data is cached in the first cache;

[0024] If the required space is greater than the available space of the first cache, the unread data in the data segment is cached according to the available space of the first cache. After the data in the first cache is read, the data in the first cache is deleted, and the unread data in the data segment is cached again according to the available space of the first cache, until the data segment is read completely.

[0025] Preferably, caching the data in the data segment other than the first target data into the first cache further includes:

[0026] The data in the data segment, excluding the first target data, are sorted according to their importance to obtain the sorted target segments. The sorted target segments are then divided into blocks and cached in batches into the first cache.

[0027] The importance of the data in the data segment other than the first target data is evaluated by the data type, data generation time, and data access frequency.

[0028] Preferably, before updating the first cache, the method further includes:

[0029] Obtain the thread lock identifier that issued the data read request, and set the first lock identifier corresponding to the thread lock identifier in the first cache. Obtain the real-time thread lock identifier of the thread that sent the request to update the first cache, and match the real-time thread lock identifier and the first lock identifier. If they match, update the first cache; otherwise, refuse to update the first cache.

[0030] Preferably, before constructing the first cache based on the first identifier information, the method further includes:

[0031] Obtain the first identifier information corresponding to the next data request. If the first identifier information corresponding to the next data request is different from the first identifier information corresponding to the current data request, delete all data in the first cache.

[0032] If the first identifier information corresponding to the next data request is the same as the first identifier information corresponding to the current data request, then delete part of the data in the first cache.

[0033] Preferably, deleting a portion of the data in the first cache specifically includes: scoring all the data in the first cache, sorting all the data in the first cache according to the scores, and deleting data from the second threshold in ascending order of scores.

[0034] Preferably, all data in the first cache is scored, specifically including: scoring all data in the first cache according to the frequency of data access, the type of data, and the time of the last data access.

[0035] Preferably, before constructing the first cache based on the first identifier information, the method further includes:

[0036] Obtain a data request queue, which includes multiple data read requests. Prioritize the multiple data read requests to obtain an ordered data request queue. Extract data read requests sequentially from the ordered data request queue as the current processing request, read and return the data.

[0037] Preferably, prioritizing the plurality of data read requests specifically includes:

[0038] Based on the latency requirements of each data read request, the type of data being accessed, and the initiation time of each data read request, a score is calculated for each data read request, and the multiple data read requests are sorted from high to low according to the score.

[0039] The present invention also provides a data reading device, comprising:

[0040] The caching module is used to construct a first cache based on the first identifier information, and update the first cache when the target page number identifier is not found after searching in the first cache;

[0041] The first identification information is related to the data requesting user. When the first cache is constructed, the first cache stores the data with the highest priority corresponding to the first identification information. After the first cache is updated, the first cache stores the data corresponding to the target page number identifier.

[0042] The data reading module is used to obtain the target page number identifier of the requested data, check whether the target page number identifier exists in the first cache, and if it exists, read the requested data from the first cache.

[0043] The present invention also provides an electronic device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to perform the steps of the aforementioned data reading method.

[0044] Compared to existing technologies, the data reading method, apparatus, and electronic device provided by this invention utilize a first cache for both estimated and real-time data backup. On one hand, by using the first cache, before a data request, the data corresponding to the first identifier information is pre-stored based on the estimated data that the first identifier information might access. When the target page number is in the first cache, the data search time in the database can be significantly shortened, and data can be directly read from the first cache. On the other hand, if the target page number is not in the first cache, the data reading method provided by this invention can also cache the requested data during the data request process by updating the first cache, ensuring that the data request is primarily read from the cache, minimizing the need for database searches. This significantly shortens the data reading time, and throughout the entire data reading process, no modifications to the database and system interfaces are required, reducing system operation and maintenance costs. Compared to existing technologies that directly retrieve data from the database using information in the data request or arbitrarily store partial data in the cache for later retrieval, this invention, on the one hand, utilizes a first cache to store data corresponding to the first identifier information before the data request. When the target page number is identified in the first cache, the data search time in the database can be significantly shortened, allowing data to be retrieved directly from the first cache. On the other hand, this invention uses the first cached data to cache the requested data during the data request process, ensuring that the data request primarily retrieves data from the cache, minimizing the need for database searches. This significantly reduces data retrieval speed, and throughout the entire data retrieval process, no modifications to the database and system interfaces are required, reducing system operation and maintenance costs. Furthermore, based on the setting of the first identifier information, the pre-cached data in the first cache is user-specific, rather than arbitrarily stored partial data. Pre-caching targeted data increases the likelihood of finding the requested data in the cache, thereby greatly shortening the data retrieval time.

[0045] The above description is merely an overview of the technical solution of the present invention. In order to better understand the technical means of the present invention and to implement it in accordance with the contents of the specification, and to make the above and other objects, features and advantages of the present invention more apparent and understandable, specific embodiments of the present invention are described below. Attached Figure Description

[0046] One or more embodiments are illustrated by way of example with reference numerals in the accompanying drawings. These illustrations do not constitute a limitation on the embodiments. Elements with the same reference numerals in the drawings are denoted as similar elements. Unless otherwise stated, the figures in the drawings are not to be limited by scale.

[0047] Figure 1A flowchart of a data reading method provided in an embodiment of the present invention;

[0048] Figure 2 This is a schematic diagram of the data reading device provided in an embodiment of the present invention. Detailed Implementation

[0049] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the various embodiments of the present invention will be described in detail below with reference to the accompanying drawings. However, those skilled in the art will understand that many technical details are presented in the various embodiments of the present invention to facilitate a better understanding of this application. However, the technical solutions claimed in this application can be implemented even without these technical details and various changes and modifications based on the following embodiments. The division of the various embodiments below is for ease of description and should not constitute any limitation on the specific implementation of the present invention. The various embodiments can be combined with and referenced by each other without contradiction.

[0050] The first embodiment of the present invention relates to a data reading method, such as... Figure 1 As shown, the data reading method includes:

[0051] A first cache is constructed based on the first identification information; the target page number identifier of the requested data is obtained, and the existence of the target page number identifier is checked in the first cache; if it does not exist, the first cache is updated, and the requested data is obtained using the first method; if it exists, the requested data is read from the first cache; wherein, the first identification information is related to the data requesting user, when constructing the first cache, the first cache stores the data with the highest priority corresponding to the first identification information, and after updating the first cache, the first cache stores the data corresponding to the target page number identifier.

[0052] Compared to existing technologies that directly retrieve data from the database using information in the data request or arbitrarily store partial data in the cache for later retrieval, this invention, on the one hand, utilizes a first cache to store data corresponding to the first identifier information before the data request. When the target page number is identified in the first cache, the data search time in the database can be significantly shortened, allowing data to be retrieved directly from the first cache. On the other hand, this invention uses the first cached data to cache the requested data during the data request process, ensuring that the data request primarily retrieves data from the cache, minimizing the need for database searches. This significantly reduces data retrieval time, and throughout the entire data retrieval process, no modifications to the database and system interfaces are required, reducing system operation and maintenance costs. Furthermore, based on the setting of the first identifier information, the pre-cached data in the first cache is user-specific, rather than arbitrarily stored partial data. Pre-caching targeted data increases the likelihood of finding the requested data in the cache, thereby greatly shortening data retrieval time.

[0053] Furthermore, the first identification information includes at least a user identifier. The user identifier is obtained before requesting data, thus obtaining the first identification information. As an optional embodiment, the user identifier can be obtained when establishing a communication connection, i.e., during a handshake with the system. As another optional embodiment, the user identifier can be sent separately before sending the data request. Constructing a first cache based on the first identification information specifically includes: statistically analyzing the data requested by the user corresponding to the user identifier within a first historical time period, obtaining the importance of the historical access data, extracting first data with the same data type as the historical access data with the highest importance, and caching the first data in the first cache to construct the first cache. Specifically, the first historical time period is the first time period closest to the current data request, i.e., obtaining historical access data within the first time period closest to the current data request time for data request preference analysis. The importance of the historical access data includes evaluating its importance based on the first attribute information of the historical access data. The first attribute information includes the frequency of data access, the type of accessed data, and the time of the most recent access before the current data request time. After obtaining the importance of the historical access data, the historical access data is sorted from high to low importance to extract first data with the same data type as the historical access data with the highest importance.

[0054] As an optional embodiment, after extracting the first data with the same data type as the historical access data with the highest importance and caching the first data in the first cache, the method further includes: determining whether the first cache is full; if there is still free space in the first cache, storing the data with the highest importance ranking in the first cache according to the ranking result of the historical access data, until the first cache is full.

[0055] The data reading method provided by this invention first extracts historical data reading information based on user identification information before receiving a data reading request. Then, through statistical analysis, it predicts the data most likely to be read in the upcoming data reading request and stores it in a first cache. This reduces the frequency of data reading from the database during data reading request processing, shortening the data query time. Furthermore, the amount of data in the cache is smaller than the amount of data in the database, further reducing data reading time by retrieving the target data from the first cache. Compared to the random data caching method in existing technologies, the caching method provided by this invention, based on the analysis of users' historical data reading behavior data, caches data in a targeted manner according to preliminary predictions, improving the effectiveness of data caching and thus shortening data reading time.

[0056] As an optional embodiment, the first method is a page skipping method. Further, if the data does not exist, the first cache is updated, and the requested data is obtained using the first method. Specifically, this includes: deleting the original data in the first cache, locating the data segment in the database using the first method, the target page number identifier, and the requested data volume, reading the first target data of the data segment and returning it to the requester, and caching the data in the data segment other than the first target data in the first cache to update the first cache. The first target data is a portion of the data in the data segment, and the size of the first target data is a first threshold.

[0057] As an optional embodiment, caching the data in the data segment excluding the first target data into the first cache specifically includes: calculating the space required for the data in the data segment excluding the first target data and the free space of the first cache; if the required space is less than or equal to the free space of the first cache, caching the data in the data segment excluding the first target data into the first cache; if the required space is greater than the free space of the first cache, caching the unread portion of the data in the data segment according to the free space of the first cache, and after the data in the first cache is read, deleting the data in the first cache, and caching the unread data in the data segment again according to the free space of the first cache, until the data segment is completely read.

[0058] The data reading method provided by this invention can read a portion of the data directly from the database when the initial estimation fails to cache the target data in the first cache. Since only a portion of the data is read at this time, the return speed of the target data is very fast. In addition to the portion of data that is read directly, the rest of the data is cached in the first cache before reading, thereby reducing the need to directly search and return data from the database and reading data directly from the cache with a smaller storage space, which greatly shortens the data reading time.

[0059] As an optional embodiment, caching the data in the data segment other than the first target data in the first cache further includes: prioritizing the data in the data segment other than the first target data according to its importance to obtain a sorted target segment; and caching the sorted target segments in blocks and batches in the first cache. The importance of the data in the data segment other than the first target data is evaluated by data type, data generation time, and data access frequency. Since the remaining free space in the first cache is smaller than the size of the data in the data segment other than the first target data, the data is cached in batches and blocks sequentially in the first cache. When batching and blocking, the data is prioritized to be sorted according to its importance, thereby prioritizing the caching, reading, and returning of data with higher importance, which can greatly improve the system's data utilization efficiency and thus improve the user experience.

[0060] Furthermore, before updating the first cache, the method further includes obtaining the thread lock identifier of the thread that issued the data read request, setting a first lock identifier corresponding to the thread lock identifier in the first cache, obtaining the real-time thread lock identifier of the thread that sent the request to update the first cache, and matching the real-time thread lock identifier and the first lock identifier. If they match, the first cache is updated; otherwise, the update of the first cache is rejected. Typically, data read requests are concurrent and multi-threaded. However, the method provided by this invention uses the first cache to predict the data to be read and processes the data read request in a single thread. To prevent other threads from interfering with the data in the first cache, the thread and cache are matched again by setting a lock identifier, ensuring that only a specific thread can update the data in the first cache. This means the first cache is dedicated to processing the current data read request, preventing data tampering and protecting data security. Ultimately, this shortens the processing time of the data read request and speeds up data reading.

[0061] Furthermore, before constructing the first cache based on the first identifier information, the method further includes deleting all or part of the data in the first cache. As an optional embodiment, the first identifier information corresponding to the next data request is obtained. If the first identifier information corresponding to the next data request is different from the first identifier information corresponding to the current data request, all data in the first cache is deleted; if the first identifier information corresponding to the next data request is the same as the first identifier information corresponding to the current data request, part of the data in the first cache is deleted. Specifically, deleting part of the data in the first cache includes: scoring all data in the first cache, sorting all data in the first cache according to the scores, and deleting data from a second threshold according to the scores from low to high. Scoring all data in the first cache specifically includes scoring all data in the first cache based on the frequency of data access, the type of data, and the last data access time. When maintaining the data in the first cache, if the next data read request to be processed still comes from the same user, the data with high scores is retained in the first cache for later reading, reducing the search and matching time required for repeated data reading and further accelerating the data reading speed. Furthermore, the data reading method also includes: calculating the dwell time of each cached data in the first cache data, wherein the dwell time represents the time the data stays in the first cache; if the dwell time exceeds a first time threshold, deleting the cached data whose dwell time exceeds the first time threshold.

[0062] As an optional embodiment, before constructing the first cache based on the first identifier information, the method further includes: obtaining a data request queue, which includes multiple data read requests; prioritizing the multiple data read requests to obtain an ordered data request queue; and sequentially extracting data read requests from the ordered data request queue as the currently processed requests, reading and returning the data. Specifically, prioritizing the multiple data read requests includes: calculating a score for each data read request based on its latency requirement, the type of data accessed, and the initiation time of each data read request; and sorting the multiple data read requests from highest to lowest score. For example, requests with high latency requirements, accessed data that is user account password information, and earlier request initiation times will have higher scores and will be ranked higher and executed first.

[0063] As an optional embodiment, reading the requested data from the first cache specifically includes: using the target page number identifier to perform primary key filtering on the primary key index of the data in the first cache, locating the data corresponding to the target page number identifier, reading the located data block, determining whether the number of read data is the same as the number of requested data; if they are the same, ending the data reading; otherwise, updating the target page number identifier according to the page number identifier corresponding to the data not read in the requested data, triggering an update of the first cache.

[0064] Embodiment 2 of the present invention provides a data reading device, such as Figure 2 As shown, the data reading device includes:

[0065] The caching module is used to construct a first cache based on the first identifier information, and update the first cache when the target page number identifier is not found after searching in the first cache;

[0066] The first identification information is related to the data requesting user. When the first cache is constructed, the first cache stores the data with the highest priority corresponding to the first identification information. After the first cache is updated, the first cache stores the data corresponding to the target page number identifier.

[0067] The data reading module is used to obtain the target page number identifier of the requested data, check whether the target page number identifier exists in the first cache, and if it exists, read the requested data from the first cache.

[0068] It is not difficult to see that this embodiment is a device embodiment corresponding to the first embodiment, and this embodiment can be implemented in conjunction with the first embodiment. The relevant technical details mentioned in the first embodiment are still valid in this embodiment, and will not be repeated here to reduce repetition. Accordingly, the relevant technical details mentioned in this embodiment can also be applied to the first embodiment.

[0069] It is worth mentioning that all modules involved in this embodiment are logical modules. In practical applications, a logical unit can be a physical unit, a part of a physical unit, or a combination of multiple physical units. Furthermore, to highlight the innovative aspects of this invention, this embodiment does not introduce units that are not closely related to solving the technical problem proposed by this invention; however, this does not mean that other units are absent from this embodiment.

[0070] A third embodiment of the present invention also provides a data reading electronic device, comprising: a memory, a processor, and a computer program for a data reading method stored in the memory and executable on the processor, wherein:

[0071] The processor is used to invoke a computer program stored in memory and execute the following steps: constructing a first cache based on first identification information; obtaining the target page number identifier of the requested data and checking whether the target page number identifier exists in the first cache; if it does not exist, updating the first cache and obtaining the requested data using a first method; if it exists, reading the requested data from the first cache; wherein, the first identification information is related to the data requesting user, when constructing the first cache, the first cache stores the data with the highest priority corresponding to the first identification information, and after updating the first cache, the first cache stores the data corresponding to the target page number identifier.

[0072] The electronic device provided in this embodiment of the invention can be applied to devices such as smartphones, computers, and servers capable of data reading. The electronic device provided in this embodiment of the invention can implement each process of the data reading method described in the above-described method embodiments and can achieve the same beneficial effects. To avoid repetition, further details are omitted here.

[0073] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. The storage medium can be a magnetic disk, optical disk, read-only memory (ROM), or random access memory (RAM), etc.

[0074] Those skilled in the art will understand that the above embodiments are specific examples of implementing the present invention, and in practical applications, various changes in form and detail may be made without departing from the spirit and scope of the present invention.

Claims

1. A data reading method, characterized in that, The data reading method includes: A first cache is constructed based on first identification information, wherein the first identification information includes at least a user identifier. Data requested by the user corresponding to the user identifier within a first historical time period is statistically analyzed to obtain the importance of the historical access data. First data with the same data type as the historical access data with the highest importance is extracted and cached in the first cache to construct the first cache. It is then determined whether the first cache is full. If there is still free space in the first cache, the data with the highest importance ranking is sequentially obtained according to the historical access data importance ranking and stored in the first cache until the first cache is full. Obtain the target page number identifier of the requested data, and check whether the target page number identifier exists in the first cache; If it does not exist, update the first cache and retrieve the requested data using the first method; If it exists, read the requested data from the first cache; The first identification information is related to the data requesting user. When the first cache is constructed, the first cache stores the data with the highest priority corresponding to the first identification information. After the first cache is updated, the first cache stores the data corresponding to the target page number identifier.

2. The data reading method according to claim 1, characterized in that, The first historical time period is the first time period since the current data request; The importance of historical access data includes: evaluating the importance based on the first attribute information of the historical access data, which includes the frequency of data access, the type of data accessed, and the time of the most recent access before the current data request. After determining the importance of historical access data, the historical access data is sorted from highest to lowest importance in order to extract the first data that has the same data type as the historical access data with the highest importance.

3. The data reading method according to claim 1, characterized in that, The first method is a page-skipping method. If the cache does not exist, the first cache is updated, and the requested data is obtained using the first method, specifically including: The original data in the first cache is deleted. The data segment is located in the database using the first method, the target page number identifier, and the requested data volume. The first target data of the data segment is read and returned to the requester. The data in the data segment other than the first target data is cached in the first cache to update the first cache. The first target data is a part of the data segment.

4. The data reading method according to claim 3, characterized in that, Cache the data in the data segment other than the first target data into the first cache, specifically including: Calculate the space required for the data in the data segment excluding the first target data and the free space of the first cache; If the required space is less than or equal to the free space of the first cache, the data in the data segment other than the first target data is cached in the first cache; If the required space is greater than the available space of the first cache, the unread data in the data segment is cached according to the available space of the first cache. After the data in the first cache is read, the data in the first cache is deleted, and the unread data in the data segment is cached again according to the available space of the first cache, until the data segment is read completely.

5. The data reading method according to claim 4, characterized in that, Cache the data in the data segment other than the first target data into the first cache, and further include: The data in the data segment, excluding the first target data, are sorted according to their importance to obtain the sorted target segments. The sorted target segments are then divided into blocks and cached in batches into the first cache. The importance of the data in the data segment other than the first target data is evaluated by the data type, data generation time, and data access frequency.

6. The data reading method according to claim 1, characterized in that, Before updating the first cache, the following is also included: Obtain the thread lock identifier that issued the data read request, and set the first lock identifier corresponding to the thread lock identifier in the first cache. Obtain the real-time thread lock identifier of the thread that sent the request to update the first cache, and match the real-time thread lock identifier and the first lock identifier. If they match, update the first cache; otherwise, refuse to update the first cache.

7. The data reading method according to claim 1, characterized in that, Before constructing the first cache based on the first identifier information, the method further includes: Obtain the first identifier information corresponding to the next data request. If the first identifier information corresponding to the next data request is different from the first identifier information corresponding to the current data request, delete all data in the first cache. If the first identifier information corresponding to the next data request is the same as the first identifier information corresponding to the current data request, then delete part of the data in the first cache.

8. The data reading method according to claim 7, characterized in that, Deleting a portion of the data in the first cache specifically includes: scoring all the data in the first cache, sorting all the data in the first cache according to the scores, and deleting data from the second threshold according to the scores from low to high.

9. The data reading method according to claim 8, characterized in that, Scoring all data in the first cache includes scoring all data in the first cache based on the frequency of data access, the type of data, and the time of the last data access.

10. The data reading method according to claim 1, characterized in that, Before constructing the first cache based on the first identifier information, the following steps are also included: Obtain a data request queue, which includes multiple data read requests. Prioritize the multiple data read requests to obtain an ordered data request queue. Extract data read requests sequentially from the ordered data request queue as the current processing request, read and return the data.

11. The data reading method according to claim 10, characterized in that, Prioritizing the multiple data read requests specifically includes: Based on the latency requirements of each data read request, the type of data being accessed, and the initiation time of each data read request, a score is calculated for each data read request, and the multiple data read requests are sorted from high to low according to the score.

12. A data reading device, characterized in that, The data reading device includes: A caching module is used to construct a first cache based on first identification information, and update the first cache when the target page number identifier is not found in the first cache. The first identification information includes at least a user identifier. The module counts the data requested by the user corresponding to the user identifier within a first historical time period, obtains the importance of the historical access data, extracts first data with the same data type as the historical access data with the highest importance, and caches the first data in the first cache to construct the first cache. The module also determines whether the first cache is full. If there is still free space in the first cache, the module sequentially obtains the data with the highest importance ranking according to the historical access data and stores it in the first cache until the first cache is full. The first identification information is related to the data requesting user. When the first cache is constructed, the first cache stores the data with the highest priority corresponding to the first identification information. After the first cache is updated, the first cache stores the data corresponding to the target page number identifier. The data reading module is used to obtain the target page number identifier of the requested data, check whether the target page number identifier exists in the first cache, and if it exists, read the requested data from the first cache.

13. An electronic device, comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the computer program, implements the steps of the data reading method as described in any one of claims 1-11.

Citation Information

Patent Citations

  • Cache data paging query method and system and computer readable storage medium

    CN111367952A

  • Data caching method, device and system and readable storage medium

    CN111563106A

  • Data query method, device and equipment and storage medium

    CN112182040A

  • Scheduling of reconstructive I / O read operations in a storage environment

    US20120066449A1