A method and device for updating corpus data, a computer device and a storage medium

CN117370365BActive Publication Date: 2026-10-09CHINA PING AN LIFE INSURANCE CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202311315977.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-10-11
Publication Date
2026-10-09
Estimated Expiration
2043-10-11

AI Technical Summary

Technical Problem

[0004]本发明实施例提供一种更新语料数据的方法、装置、计算机设备及存储介质,以解决在短时间内对多个不同服务的语料数据进行密集操作导致的服务器性能降低的问题

Benefits of technology

[0044] The aforementioned method, apparatus, computer equipment, and storage medium for updating corpus data first parses the operation requests for updating the corpus data to determine the data category of the corpus data. Then, the corpus data is written to a cache pool to obtain cached data, and the write time of the cached data is recorded. Next, the cache pool is periodically traversed according to the preset cache duration corresponding to the data category. When cached data is encountered in the cache pool, the write time is added to the preset cache duration to obtain the preset send time. Finally, it is determined whether the preset send time is less than or equal to the current device time. If so, an update command is sent to the service corresponding to the corpus data to complete the update of the corpus data. Because this method does not immediately send the obtained operation requests directly to the service corresponding to the corpus data, but instead sets a preset cache duration, if frequent operation requests for the same corpus data occur within the preset cache duration, they will be recorded as cached data until the preset cache duration is exceeded, at which point an update command is sent to the service corresponding to the corpus data. This solves the server performance loss caused by frequent updates to corpus data in a short period of time, effectively improving server performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117370365B_ABST
    Figure CN117370365B_ABST
Patent Text Reader

Abstract

The present application relates to the field of load allocation, and particularly discloses a corpus data updating method and device, computer equipment and storage medium to solve the problem of server performance reduction caused by intensive operation of corpus data of multiple different services in a short time. The method comprises: parsing an operation request for updating corpus data to obtain a data category of the corpus data; writing the corpus data into a cache pool to obtain cache data and record the write time of the cache data; periodically traversing the cache pool according to a preset cache duration corresponding to the data category; when the cache data in the cache pool is traversed, adding the write time to the preset cache duration to obtain a preset sending time; determining whether the preset sending time is greater than or equal to the current device time; if yes, sending an update instruction to the service corresponding to the corpus data to complete the update of the corpus data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of load balancing, and more particularly to a method, apparatus, computer device, and storage medium for updating corpus data. Background Technology

[0002] Computational linguistics is an emerging interdisciplinary field that uses computers to study and process natural language. In the process of processing natural language (NLP), machine learning models need to perform operations such as suggestion and search on large-scale corpora. In one possible implementation, the corpus data is medical text, which can be electronic healthcare records—electronic personal health records, including medical records, electrocardiograms, medical images, and other electronic records with archival value.

[0003] Each time the corpus data is manipulated, indexing or other types of operations are required. Due to the widespread use of smart devices, more and more devices can access the corpus data stored on the server via the network. This easily leads to a large number of intensive operations on a single corpus within a short period, causing the server to continuously execute a large amount of complex logic, such as index creation, within a short timeframe. Furthermore, the server may contain one or more services, each corresponding to different corpus data. Therefore, when the server executes complex logic for multiple different services simultaneously, its performance will be significantly depleted. Thus, intensive operations on corpus data from multiple different services within a short period will result in reduced server performance. Summary of the Invention

[0004] This invention provides a method, apparatus, computer device, and storage medium for updating corpus data, in order to solve the problem of reduced server performance caused by intensive operations on corpus data from multiple different services within a short period of time.

[0005] A method for updating corpus data includes:

[0006] Parse the operation request to update the corpus data to determine the data category of the corpus data;

[0007] The corpus data is written into the cache pool to obtain cached data, and the writing time of the cached data is recorded.

[0008] According to the preset cache duration corresponding to the data category, the cache pool is traversed periodically;

[0009] When the cached data in the cache pool is traversed, the write time is added to the preset cache duration to obtain the preset send time;

[0010] Determine whether the preset sending time is less than or equal to the current device time;

[0011] If so, an update instruction is sent to the service corresponding to the corpus data to complete the update of the corpus data.

[0012] In one possible design, writing the corpus data into a cache pool to obtain cached data, and recording the write time of the cached data, includes:

[0013] Determine whether the cached data corresponding to the operation request exists in the cache pool;

[0014] If it does not exist, the corpus data is directly written into the cache pool to obtain the cache data;

[0015] Record the write time of the cached data.

[0016] In one possible design, after determining whether the cached data corresponding to the operation request exists in the cache pool, the method further includes:

[0017] If it exists, then find the cached data corresponding to the corpus data;

[0018] Update the write time corresponding to the cached data to the current device time.

[0019] In one possible design, the step of adding the write time to the preset cache duration to obtain the preset send time when the cached data is encountered includes:

[0020] Within the preset cache duration, the total number of operation requests is counted;

[0021] When the cached data is traversed, the total number of times corresponding to the cached data is obtained;

[0022] Determine whether the total number of times is greater than the expected number of times;

[0023] If so, the write time is added to the preset cache duration to obtain the preset send time.

[0024] In one possible design, counting the total number of operation requests includes:

[0025] After obtaining the operation request, determine whether there is a record of the number of times the operation request corresponds to;

[0026] If it exists, increment the number of records by one to obtain the total number of records;

[0027] If it does not exist, then generate the number of records corresponding to the operation request, and set the initial value of the number of records to one;

[0028] The number of records is taken as the total number.

[0029] In one possible design, before sending the update instruction to the service corresponding to the corpus data, the method further includes:

[0030] A configuration page for generating the corpus data;

[0031] Display the configuration page;

[0032] Through the configuration page, the services configured for the corpus data are obtained, which are the services corresponding to the corpus data.

[0033] In one possible design, after sending the update instruction to the service corresponding to the corpus data, the method further includes:

[0034] Clear the total number of times corresponding to the cached data to zero.

[0035] An apparatus for updating corpus data, comprising:

[0036] The parsing module is used to parse operation requests that update the corpus data and determine the data category of the corpus data;

[0037] The writing module is used to write the corpus data into the cache pool, obtain cached data, and record the writing time of the cached data;

[0038] The traversal module is used to periodically traverse the cache pool according to the preset cache duration corresponding to the data category;

[0039] The calculation module is used to add the write time to the preset cache duration when iterating through the cached data in the cache pool to obtain the preset send time;

[0040] The judgment module is used to determine whether the preset sending time is less than or equal to the current device time;

[0041] The sending module is used to send an update instruction to the service corresponding to the corpus data if the condition is met, so as to complete the update of the corpus data.

[0042] A computer device includes 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 implement the steps of the method for updating corpus data described above.

[0043] A computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the method for updating corpus data described above.

[0044] The aforementioned method, apparatus, computer equipment, and storage medium for updating corpus data first parses the operation requests for updating the corpus data to determine the data category of the corpus data. Then, the corpus data is written to a cache pool to obtain cached data, and the write time of the cached data is recorded. Next, the cache pool is periodically traversed according to the preset cache duration corresponding to the data category. When cached data is encountered in the cache pool, the write time is added to the preset cache duration to obtain the preset send time. Finally, it is determined whether the preset send time is less than or equal to the current device time. If so, an update command is sent to the service corresponding to the corpus data to complete the update of the corpus data. Because this method does not immediately send the obtained operation requests directly to the service corresponding to the corpus data, but instead sets a preset cache duration, if frequent operation requests for the same corpus data occur within the preset cache duration, they will be recorded as cached data until the preset cache duration is exceeded, at which point an update command is sent to the service corresponding to the corpus data. This solves the server performance loss caused by frequent updates to corpus data in a short period of time, effectively improving server performance. Attached Figure Description

[0045] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0046] Figure 1 This is a schematic diagram of an application environment for a method of updating corpus data according to an embodiment of the present invention;

[0047] Figure 2 This is a flowchart illustrating a method for updating corpus data in one embodiment of the present invention;

[0048] Figure 3 This is a flowchart illustrating a method for updating corpus data in one embodiment of the present invention;

[0049] Figure 4 This is a flowchart illustrating a method for updating corpus data in one embodiment of the present invention;

[0050] Figure 5 This is a flowchart illustrating a method for updating corpus data in one embodiment of the present invention;

[0051] Figure 6 This is a flowchart illustrating a method for updating corpus data in one embodiment of the present invention;

[0052] Figure 7 This is a flowchart illustrating a method for updating corpus data in one embodiment of the present invention;

[0053] Figure 8 This is a schematic diagram of a device for updating corpus data according to an embodiment of the present invention;

[0054] Figure 9 This is a schematic diagram of a computer device according to an embodiment of the present invention. Detailed Implementation

[0055] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0056] The method for updating corpus data provided in this embodiment of the invention can be applied to, for example... Figure 1 In this application environment, the terminal device communicates with the server via a network. The terminal device sends an update request to the server for a specific corpus of data. Upon receiving the request, the server parses it to update the corpus data. The terminal device can be, but is not limited to, various personal computers, laptops, smartphones, tablets, and portable wearable devices. The server can be a standalone server or a server cluster consisting of multiple servers.

[0057] In one embodiment, such as Figure 2 As shown, a method for updating corpus data is provided, which can be applied to... Figure 1 Taking the server in the example, the following steps are included:

[0058] S10: Parse the operation request to update the corpus data and determine the data category of the corpus data.

[0059] The server receives and parses an operation request to update the corpus data, identifying the data category of the corpus data. Here, corpus data refers to language material data, which is the content data for linguistic research, typically a collection of text resources of a certain quantity and scale. The operation request refers to the signal and information carried by the server to update a specific piece of corpus data, including but not limited to executable event processing, automation, and HTTP / HTTPS requests for that specific corpus data. The data category refers to the classification of the corpus data, including but not limited to classification by business type or by data source. In this embodiment, the data category is represented by a unique identifier, for example, using `configId` to identify the data category of the corpus data.

[0060] S20: Write the corpus data into the cache pool to obtain cache data, and record the writing time of the cache data.

[0061] The corpus data is written to the buffer pool to obtain the cached data, and the write time of the cached data is recorded. The buffer pool is essentially a region in memory. When the corpus data is accessed, the data and the corresponding index are cached in the buffer pool. The cached data refers to the data that is temporarily stored in the buffer pool, and the write time refers to the time when the corpus data is written to the buffer pool.

[0062] S30: According to the preset cache duration corresponding to the data category, the cache pool is traversed periodically.

[0063] The system pre-sets the cache duration for each data category. Then, it periodically iterates through the cached data in the cache pool. This iteration refers to accessing all cached data in the cache pool without repetition, according to certain rules. The pre-set cache duration is the cache duration pre-defined based on the data category. This pre-set cache duration can be read from a pre-defined configuration file or obtained from a pre-defined interface; no specific limitation is made here.

[0064] S40: When the cached data in the cache pool is traversed, the write time is added to the preset cache duration to obtain the preset send time.

[0065] When the cached data is encountered, the write time is added to the preset cache duration to obtain the preset send time. The preset send time refers to the expected time to send the update command to the corresponding service.

[0066] S50: Determine whether the preset sending time is less than or equal to the current device time.

[0067] Determine whether the preset sending time is less than or equal to the current device time, where the current device time refers to the server's current system time. If the preset sending time is greater than the current device time, it means that the cached data has not yet reached the preset sending time. If the preset sending time is less than or equal to the current device time, it means that the cached data has reached or exceeded the preset sending time.

[0068] For example, if we sequentially traverse all records, assuming we are traversing the data item item1 in the cache pool, which is the cached data, and the current (write time pushTime + preset cache duration) of this record is less than the current time, then it means that item1 has met the sending conditions.

[0069] S60: If so, send an update instruction to the service corresponding to the corpus data to complete the update of the corpus data.

[0070] If the preset sending time is less than or equal to the current device time, an update command is sent to the service corresponding to the expected data to complete the update. The service corresponding to the corpus data refers to a server subsystem that performs a specific function. The service runs in the memory space of its parent container (server) using the process ID of that container. The update command refers to the signal received by the server to update a specific corpus data and the information carried by the signal, including but not limited to executable event handling, automation, and HTTP / HTTPS requests for that specific corpus data.

[0071] For example, different types of corpora can have their own preset cache duration (pushRelayTime). For data types with configId A, the duration is set to 60 seconds, and for data types with configId B, it is set to 120 seconds. This means that if there is a corpus update for configId-A, the most recent update time will be used, and an update command will be sent to the service if it exceeds 60 seconds. For configId-B, the duration is set to 120 seconds. In addition, this preset cache duration configuration supports real-time refresh and takes effect immediately.

[0072] It should be noted that, since this embodiment does not immediately send the obtained operation requests directly to the service corresponding to the corpus data, but sets a preset caching time, if frequent operation requests for the same corpus data occur within the preset caching time, they will be recorded as cached data until the preset caching time is exceeded, and then an update instruction is sent to the service corresponding to the corpus data. This solves the server performance loss caused by frequent updates to the corpus data in a short period of time, and effectively improves server performance.

[0073] In one embodiment, such as Figure 3 As shown, in step S20, the corpus data is written to the cache pool to obtain cached data, and the write time of the cached data is recorded. Specifically, this includes the following steps:

[0074] S21: Determine whether the cached data corresponding to the operation request exists in the cache pool.

[0075] S22: If it does not exist, the operation request is written to the cache pool to obtain the cached data.

[0076] S23: Record the write time of the cached data.

[0077] In this embodiment, it is determined whether cached data corresponding to the operation request exists in the cache pool. If not, the operation request is directly written to the cache pool to obtain the cached data, and then the write time of the cached data is recorded. Specifically, determining whether cached data exists in the cache pool for an operation request that updates the corpus data includes, but is not limited to, the corpus data and its index. Methods for writing the operation request to the cache pool include, but are not limited to, directly recording the operation request and its corresponding corpus data, converting the operation request into a corresponding identifier or operation index, etc., and recording them separately.

[0078] It should be noted that in this embodiment, it is determined in advance whether there is cached data corresponding to the operation request in the cache pool, so as to accurately record the writing time of the cached data. This facilitates subsequent determination of whether the operation request exceeds the preset sending time, and prevents the omission or abnormality of subsequent update instructions caused by errors in the recording of cached data. This solves the server performance loss caused by frequent updates to the corpus data in a short period of time, and effectively improves server performance.

[0079] In one embodiment, such as Figure 4 As shown, after step S21, that is, after determining whether the cached data corresponding to the operation request exists in the cache pool, the method further includes the following steps:

[0080] S211: If it exists, find the cached data corresponding to the operation request.

[0081] S212: Update the write time corresponding to the cached data to the current device time.

[0082] In this embodiment, it is determined whether cached data corresponding to the operation request exists in the cache pool. If it exists, the cached data corresponding to the operation request is searched, and then the write time of the cached data is updated to the current device time. Updating the write time of the cached data to the current device time prevents the need to store each operation request in the cache pool multiple times when the operation request is sent multiple times. Simply updating the write time to the current device time is sufficient to record the time of the most recent received operation request.

[0083] It should be noted that this embodiment pre-determines whether there is cached data corresponding to the operation request in the cache pool. If there is corresponding cached data, the original recorded write time is updated to facilitate subsequent determination of whether the operation request exceeds the preset sending time. This prevents errors in the cached data recording from causing omissions or anomalies in subsequent update instructions, thereby solving the server performance loss caused by frequent updates to the corpus data in a short period of time and effectively improving server performance.

[0084] In one embodiment, such as Figure 5 As shown, in step S40, when the cached data is encountered, the write time is added to the preset cache duration to obtain the preset send time. This specifically includes the following steps:

[0085] S41: Within the preset cache duration, count the total number of operation requests.

[0086] S42: When the cached data is traversed, obtain the total number of times corresponding to the cached data.

[0087] S43: Determine whether the total number of times is greater than the expected number of times.

[0088] S44: If so, add the write time to the preset cache duration to obtain the preset send time.

[0089] In this embodiment, the total number of operation requests is counted within a preset cache duration. When cached data is encountered, the total number of requests corresponding to the cached data is obtained. Then, it is determined whether the total number is greater than the expected number. If so, the write time is added to the preset cache duration to obtain the preset sending time. In this embodiment, the expected number is set to 0. Therefore, in steps S43-S44, the total number is determined. If it is greater than 0, it means that there are still unprocessed operation requests for the corpus data on the server. If it is less than 0, it means that there are no unprocessed operation requests for the corpus data on the server.

[0090] For example, when updating one entry in the corpus with data type configId A, if there's no record in the cache pool, a data item is created and written to the cache pool, recording the current push time (e.g., updateTime1) and the total count as 1. The corpus data for approval A is continuously updated. If a record exists in the cache pool, it's retrieved, the current push time is updated to updateTime2, and the count is incremented. When updating the corpus data for approval B, if there's no record in the cache pool, a new data item is created and written to the cache pool. This allows for subsequent asynchronous thread-based periodic polling of the cache pool.

[0091] It should be noted that the reason why operation requests need to be recorded in the cache pool and the total number of operation requests is to avoid recording the operation record every time, and only need to update the total number of operations, is to reduce the server performance loss caused by multiple read and write operation requests in the cache pool and speed up the efficiency of updating the entire corpus data. This solves the server performance loss caused by frequent updates to the corpus data in a short period of time and effectively improves server performance.

[0092] In one embodiment, such as Figure 6 As shown, step S41, which involves counting the total number of operation requests, specifically includes the following steps:

[0093] S411: After obtaining the operation request, determine whether there is a record of the number of times the operation request is received.

[0094] S412: If it exists, increment the number of records by one to obtain the total number of records.

[0095] S413: If it does not exist, generate the number of records corresponding to the operation request and set the initial value of the number of records to one.

[0096] S414: The number of records is taken as the total number of records.

[0097] In this embodiment, after obtaining the operation request, it is determined whether there is a record count corresponding to the operation request: if there is, the record count is incremented by one to obtain the total count; if there is not, the record count corresponding to the operation request is generated, the initial value of the record count is set to one, and the record count is used as the total count.

[0098] It should be noted that this embodiment records the total number of operation records in the cache pool and updates the total number of records in the cache pool in real time based on the obtained operation records. This reduces the server performance loss caused by multiple read and write operation requests in the cache pool, thereby speeding up the efficiency of updating the entire corpus data. This solves the server performance loss caused by frequent updates to the corpus data in a short period of time and effectively improves server performance.

[0099] In one embodiment, such as Figure 7 As shown, before step S60, that is, before sending an update instruction to the service corresponding to the corpus data, the method further includes the following steps:

[0100] S71: Configuration page for generating the corpus data.

[0101] S72: Display the configuration page.

[0102] S73: Obtain the service configured for the corpus data through the configuration page, which is the service corresponding to the corpus data.

[0103] In this embodiment, a configuration page for generating corpus data is generated. This configuration page is then displayed, and the services configured for the corpus data are obtained through it. These services correspond to the corpus data. The configuration page is used to display the configuration of the services corresponding to the corpus data to the user, and allows the user to configure these services on the configuration page, thereby obtaining the services corresponding to the corpus data requested by the user.

[0104] For example, if data type A is configured with SUG (recommendation) and SEARCH (search) services, then the update command will be sent to these two services. After receiving the command, the services will process the pre-agreed logic, such as retrieving the corpus data from the mongo library to update the index.

[0105] It should be noted that in this embodiment, the services corresponding to the corpus data can be made available to users for manual configuration. Therefore, in steps S71-S73, corresponding configuration files are generated to collect the services corresponding to the corpus data that users expect. This provides a more flexible and efficient method for updating corpus data, allowing for on-demand configuration and thus accelerating the efficiency of the entire corpus data update. This solves the problem of server performance loss caused by frequent updates to corpus data in a short period of time, effectively improving server performance.

[0106] In one embodiment, after step S60, that is, after sending an update instruction to the service corresponding to the corpus data, the method further includes the following steps:

[0107] S81: Clear the total number of times corresponding to the cached data to zero.

[0108] In this embodiment, after the server sends an update instruction to the service corresponding to the corpus data each time, the total number of times the corpus data in the cache pool is cleared to zero.

[0109] It should be noted that in this embodiment, a cache pool is used to record the total number of operation requests received within a preset sending time. Therefore, after the server sends an update instruction each time, the corresponding total number of requests needs to be cleared to zero so that update instructions can be accurately sent to the service corresponding to the corpus data in the future based on the total number of requests. This solves the problem of server performance loss caused by frequent updates to the corpus data in a short period of time and effectively improves server performance.

[0110] In this invention, on the one hand, by temporarily storing operation requests in a cache pool, input optimization is provided for complex update logic with high frequency, avoiding unnecessary consumption of server performance. Furthermore, the actual call frequency of business operations can be configured by specifying data categories, thereby achieving dynamic allocation and on-demand settings. On the other hand, this embodiment is not limited to logic that operates on corpus data. The cached data in the cache pool supports field expansion, allowing for the abstraction of business logic and recording of request packet snapshots. These request packet snapshots include, but are not limited to, the next step's link URL, request parameters, etc., thus enriching the use cases.

[0111] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.

[0112] In one embodiment, an apparatus for updating corpus data is provided, which corresponds one-to-one with the method for updating corpus data in the above embodiments. For example... Figure 8 As shown, the device for updating corpus data includes a parsing module 10, a writing module 20, a traversal module 30, a calculation module 40, a judgment module 50, and a sending module 60. Detailed descriptions of each functional module are as follows:

[0113] The parsing module 10 is used to parse the operation request to update the corpus data and determine the data category of the corpus data;

[0114] The writing module 20 is used to write the corpus data into the cache pool, obtain cached data, and record the writing time of the cached data;

[0115] The traversal module 30 is used to traverse the cache pool periodically according to the preset cache duration corresponding to the data category.

[0116] The calculation module 40 is used to add the write time to the preset cache duration when traversing the cached data in the cache pool to obtain the preset sending time;

[0117] The judgment module 50 is used to determine whether the preset sending time is less than or equal to the current device time;

[0118] The sending module 60 is used to send an update instruction to the service corresponding to the corpus data if the condition is met, so as to complete the update of the corpus data.

[0119] The writing module 20 specifically includes:

[0120] The first judgment unit 21 is used to determine whether the cached data corresponding to the operation request exists in the cache pool;

[0121] The writing unit 22 is used to write the operation request into the cache pool if it does not exist, thereby obtaining the cached data;

[0122] Recording unit 23 is used to record the write time of the cached data.

[0123] The writing module 20 further includes:

[0124] The lookup unit 24 is used to find the cached data corresponding to the operation request if it exists;

[0125] The update unit 25 is used to update the write time corresponding to the cached data to the current device time.

[0126] The computing module 40 specifically includes:

[0127] The statistics unit 41 is used to count the total number of operation requests within the preset cache duration;

[0128] The acquisition unit 42 is used to acquire the total number of times corresponding to the cached data when the cached data is traversed;

[0129] The second judgment unit 43 is used to determine whether the total number of times is greater than the expected number of times;

[0130] The addition unit 44 is used to add the write time to the preset cache duration if the condition is met, so as to obtain the preset send time.

[0131] The acquisition unit 42 specifically includes:

[0132] After obtaining the operation request, determine whether there is a record of the number of times the operation request corresponds to;

[0133] If it exists, increment the number of records by one to obtain the total number of records;

[0134] If it does not exist, then generate the number of records corresponding to the operation request, and set the initial value of the number of records to one;

[0135] The number of records is taken as the total number.

[0136] The apparatus for updating the corpus data further includes:

[0137] Generation module 70 is used to generate a configuration page for the corpus data;

[0138] Display module 80 is used to display the configuration page;

[0139] The configuration module 90 is used to obtain the service configured for the corpus data through the configuration page, and to serve as the service corresponding to the corpus data;

[0140] The clearing module 100 is used to clear the total number of times corresponding to the cached data.

[0141] Specific limitations regarding the apparatus for updating corpus data can be found in the limitations regarding the methods for updating corpus data described above, and will not be repeated here. Each module in the aforementioned apparatus for updating corpus data can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device in hardware form, or stored in the memory of a computer device in software form, so that the processor can call and execute the operations corresponding to each module.

[0142] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 9 As shown, the computer device includes a processor, memory, network interface, and database connected via a system bus. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The database stores corpus data, data categories of the corpus data, cached data, and the write time of the cached data. The network interface is used for communication with external terminals via a network connection. When executed by the processor, the computer program implements a method for updating corpus data.

[0143] In one embodiment, a computer device is provided, including 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 following steps:

[0144] Parse the operation request to update the corpus data to determine the data category of the corpus data;

[0145] The corpus data is written into the cache pool to obtain cached data, and the writing time of the cached data is recorded.

[0146] According to the preset cache duration corresponding to the data category, the cache pool is traversed periodically;

[0147] When the cached data in the cache pool is traversed, the write time is added to the preset cache duration to obtain the preset send time;

[0148] Determine whether the preset sending time is less than or equal to the current device time;

[0149] If so, an update instruction is sent to the service corresponding to the corpus data to complete the update of the corpus data.

[0150] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, the computer program performing the following steps when executed by a processor:

[0151] Parse the operation request to update the corpus data to determine the data category of the corpus data;

[0152] The corpus data is written into the cache pool to obtain cached data, and the writing time of the cached data is recorded.

[0153] According to the preset cache duration corresponding to the data category, the cache pool is traversed periodically;

[0154] When the cached data in the cache pool is traversed, the write time is added to the preset cache duration to obtain the preset send time;

[0155] Determine whether the preset sending time is less than or equal to the current device time;

[0156] If so, an update instruction is sent to the service corresponding to the corpus data to complete the update of the corpus data.

[0157] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

[0158] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is used as an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.

[0159] The above-described embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included within the protection scope of the present invention.

Claims

1. A method for updating corpus data, characterized in that, include: Parse the operation request to update the corpus data to determine the data category of the corpus data; The corpus data is written into the cache pool to obtain cached data, and the writing time of the cached data is recorded. According to the preset cache duration corresponding to the data category, the cache pool is traversed periodically; When the cached data in the cache pool is traversed, the write time is added to the preset cache duration to obtain the preset send time, wherein the preset send time refers to the expected time to send the update instruction to the corresponding service; Determine whether the preset sending time is less than or equal to the current device time; If so, an update instruction is sent to the service corresponding to the corpus data to complete the update of the corpus data; The step of writing the corpus data into a cache pool to obtain cached data and recording the write time of the cached data includes: Determine whether the cached data corresponding to the operation request exists in the cache pool; If it does not exist, the operation request is written to the cache pool to obtain the cached data; Record the write time of the cached data; If it exists, then find the cached data corresponding to the operation request; Update the write time corresponding to the cached data to the current device time.

2. The method for updating corpus data as described in claim 1, characterized in that, When the cached data is encountered, the write time is added to the preset cache duration to obtain the preset send time, including: Within the preset cache duration, the total number of operation requests is counted; When the cached data is traversed, the total number of times corresponding to the cached data is obtained; Determine whether the total number of times is greater than the expected number of times; If so, the write time is added to the preset cache duration to obtain the preset send time.

3. The method for updating corpus data as described in claim 2, characterized in that, The total number of operation requests is counted, including: After obtaining the operation request, determine whether there is a record of the number of times the operation request corresponds to; If it exists, increment the number of records by one to obtain the total number of records; If it does not exist, then generate the number of records corresponding to the operation request, and set the initial value of the number of records to one; The number of records is taken as the total number.

4. The method for updating corpus data as described in claim 1, characterized in that, Before sending the update instruction to the service corresponding to the corpus data, the method further includes: A configuration page for generating the corpus data; Display the configuration page; Through the configuration page, the services configured for the corpus data are obtained, which are the services corresponding to the corpus data.

5. The method for updating corpus data as described in claim 1, characterized in that, After sending an update instruction to the service corresponding to the corpus data, the method further includes: Clear the total number of times corresponding to the cached data to zero.

6. An apparatus for updating corpus data, characterized in that, include: The parsing module is used to parse operation requests that update the corpus data and determine the data category of the corpus data; The writing module is used to write the corpus data into the cache pool, obtain cached data, and record the writing time of the cached data; The traversal module is used to periodically traverse the cache pool according to the preset cache duration corresponding to the data category; The calculation module is used to add the write time to the preset cache duration when iterating through the cached data in the cache pool to obtain the preset send time, wherein the preset send time refers to the expected time to send the update instruction to the corresponding service; The judgment module is used to determine whether the preset sending time is less than or equal to the current device time; The sending module is used to send an update instruction to the service corresponding to the corpus data if the condition is met, so as to complete the update of the corpus data. The step of writing the corpus data into a cache pool to obtain cached data and recording the write time of the cached data includes: Determine whether the cached data corresponding to the operation request exists in the cache pool; If it does not exist, the operation request is written to the cache pool to obtain the cached data; Record the write time of the cached data; If it exists, then find the cached data corresponding to the operation request; Update the write time corresponding to the cached data to the current device time.

7. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method for updating corpus data as described in any one of claims 1 to 6.

8. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method for updating corpus data as described in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Cache updating method and device, server and storage medium

    CN110837513A