Data caching method and apparatus, computer device, and storage medium

By obtaining target configuration information and performing cache update type detection when the business application starts, the problem of inflexible and inaccurate cache data caused by interface call failures is solved, realizing flexible and efficient cache data acquisition and improving the running efficiency of the business application.

CN116226187BActive Publication Date: 2026-03-24SHENZHEN QIANHAI BAIDI NETWORK CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-22
Publication Date
2026-03-24

AI Technical Summary

Technical Problem

When a business application starts up, existing technologies cannot flexibly handle interface call failures when directly calling multiple interfaces to retrieve cached data, resulting in inflexible and inaccurate retrieval of cached data.

Method used

By obtaining the target configuration information of the business application, the call records of the target interface are determined, and cache update type detection is performed. Only when the type detection result is the target type, cached data is read from the server cache and cached in the page cache.

Benefits of technology

It improves the flexibility and accuracy of cached data retrieval, enhances the operational efficiency of business applications, reduces repetitive API calls, and saves resource consumption.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116226187B_ABST
    Figure CN116226187B_ABST
Patent Text Reader

Abstract

The application relates to a data caching method and device, computer equipment and a storage medium. The method comprises the following steps: obtaining target configuration information of a service application, wherein the target configuration information comprises a target interface, a path field and a cache update field; then determining the calling record of the target interface according to the path field, and when the calling record indicates that the target interface is called again, performing update type detection on the cache update field to obtain a type detection result. In this way, when the type detection result is a target type, the cache data can be read from a server cache, and the cache data can be cached to a page cache. The method can improve the flexibility of data caching.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of Internet technology, and in particular to a data caching method, apparatus, computer device, and storage medium. Background Technology

[0002] With the development of Internet technology, various business applications require more and more resources. When a business application is started, it will call the corresponding interface to obtain cached data, and then render the data on the corresponding page.

[0003] Currently, when starting a business application, the business side first identifies multiple interfaces corresponding to different stages of the application and directly calls these interfaces to obtain the cached data for the current stage. However, this approach of calling interfaces indiscriminately without considering the actual call behavior leads to the inability to obtain the required cached data for the corresponding page when a call fails. Therefore, this application aims to address the problem of how to flexibly cache data and improve the flexibility of obtaining cached data for business applications. Summary of the Invention

[0004] Therefore, it is necessary to provide a data caching method, apparatus, computer equipment, storage medium, and computer program product that can improve the flexibility of data caching in response to the above-mentioned technical problems.

[0005] Firstly, this application provides a data caching method. The method includes:

[0006] When a business application is started, the target configuration information of the business application is obtained; the target configuration information includes the target interface, path field, and cache update field.

[0007] The call record of the target interface is determined based on the path field;

[0008] When the call record indicates that the target interface is called again, the update type of the cache update field is checked to obtain the type check result;

[0009] When the type detection result is the target type, read the cached data from the server cache;

[0010] The cached data is cached in the page cache; the page cache is used to provide cached data associated with the target page when displaying the target page of the business application.

[0011] In one embodiment, before obtaining the target configuration information of the business application, the method further includes: determining the business module corresponding to the business application; the business module includes at least one sub-module; obtaining the initial configuration information corresponding to the business module; the initial configuration information includes multiple interfaces corresponding to each sub-module and field information corresponding to each interface; and determining the target configuration information corresponding to the business application based on the multiple field information.

[0012] In one embodiment, the field information includes interface status and pre-launch time; the target configuration information includes multiple sub-configuration information; determining the target configuration information corresponding to the business application based on the multiple field information includes: for each field information, if the interface status in the current field information is online, using the current field information and the corresponding current interface as sub-configuration information; if the interface status in the current field information is pre-launch, determining the current time for obtaining the initial configuration information; if the current time and the pre-launch time meet a preset condition, then using the current field information and the corresponding current interface as sub-configuration information.

[0013] In one embodiment, after determining the call record of the target interface based on the path field, the method further includes: when the call record indicates that the target interface is being called for the first time, calling the target interface to read cached data from the database through the target interface; and caching the cached data to the page cache.

[0014] In one embodiment, after performing update type detection on the cache update field and obtaining the type detection result, the method further includes: when the type detection result is not the target type, calling the target interface to read cached data from the database through the target interface and caching the cached data to the page cache.

[0015] In one embodiment, before reading cached data from the server cache, the method further includes: determining whether cached data corresponding to the target interface exists in the server cache; if not, calling the target interface to read cached data from the database through the target interface and caching the cached data to the page cache; the step of reading cached data from the server cache includes: if yes, reading cached data from the server cache.

[0016] In one embodiment, the target configuration information further includes a validity period; before caching the cached data to the page cache, the method further includes: performing a validity check on the cached data based on the validity period to obtain a validity result; when the validity result indicates that the detection is invalid, calling the target interface to read cached data from the database through the target interface, and caching the cached data to the page cache; caching the cached data to the page cache includes: caching the cached data to the page cache when the validity result indicates that the detection is valid.

[0017] In one embodiment, calling the target interface to read cached data from the database through the target interface includes: determining the target data source and interface type corresponding to the target interface, and determining the data reading method according to the interface type; calling the target interface to query the target data source through the data reading method to obtain the cached data corresponding to the target interface.

[0018] Secondly, this application also provides a data caching device. The device includes:

[0019] The configuration information determination module is used to obtain the target configuration information of the business application when the business application is started; the target configuration information includes the target interface, path field and cache update field.

[0020] An update type detection module is used to determine the call record of the target interface based on the path field; when the call record indicates that the target interface is called again, update type detection is performed on the cache update field to obtain the type detection result;

[0021] The cache data determination module is used to read cache data from the server cache when the type detection result is the target type; cache the cache data to the page cache; the page cache is used to provide cache data associated with the target page when displaying the target page of the business application.

[0022] Thirdly, this application also provides a computer device. The computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to perform the following steps:

[0023] When a business application is started, the target configuration information of the business application is obtained; the target configuration information includes the target interface, path field, and cache update field.

[0024] The call record of the target interface is determined based on the path field;

[0025] When the call record indicates that the target interface is called again, the update type of the cache update field is checked to obtain the type check result;

[0026] When the type detection result is the target type, read the cached data from the server cache;

[0027] The cached data is cached in the page cache; the page cache is used to provide cached data associated with the target page when displaying the target page of the business application.

[0028] Fourthly, this application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, which, when executed by a processor, performs the following steps:

[0029] When a business application is started, the target configuration information of the business application is obtained; the target configuration information includes the target interface, path field, and cache update field.

[0030] The call record of the target interface is determined based on the path field;

[0031] When the call record indicates that the target interface is called again, the update type of the cache update field is checked to obtain the type check result;

[0032] When the type detection result is the target type, read the cached data from the server cache;

[0033] The cached data is cached in the page cache; the page cache is used to provide cached data associated with the target page when displaying the target page of the business application.

[0034] Fifthly, this application also provides a computer program product. The computer program product includes a computer program that, when executed by a processor, performs the following steps:

[0035] When a business application is started, the target configuration information of the business application is obtained; the target configuration information includes the target interface, path field, and cache update field.

[0036] The call record of the target interface is determined based on the path field;

[0037] When the call record indicates that the target interface is called again, the update type of the cache update field is checked to obtain the type check result;

[0038] When the type detection result is the target type, read the cached data from the server cache;

[0039] The cached data is cached in the page cache; the page cache is used to provide cached data associated with the target page when displaying the target page of the business application.

[0040] The aforementioned data caching method, apparatus, computer equipment, storage medium, and computer program product, when starting a business application, can determine the target configuration information, including the target interface, path field, and cache update field, by acquiring the target configuration information of the business application. Then, based on the path field, the call record of the target interface is determined. When the call record indicates that the target interface is being called again, the update type of the cache update field is checked to obtain the type detection result. Thus, when the type detection result is the target type, cached data can be read from the server cache and cached in the page cache. Since the execution process is based on different call records after determining the call record of the target interface, compared to the traditional method of directly calling the interface indiscriminately, this application, by checking the update type of the cache update field when the call record indicates that the target interface is being called again, can determine the cached data based on the type detection result. Therefore, even if the mart interface call fails, the cached data can still be determined, improving the flexibility of obtaining the cached data corresponding to the business application. At the same time, since cached data is only read from the server cache when the type detection result is the target type, the accuracy of cached data acquisition is also ensured.

[0041] Furthermore, this application eliminates the need for repeated API calls and additional code development for the business application each time it starts. Instead, it directly provides cached data associated with the target page when displaying the target page of the business application through page caching, thereby improving the efficiency of cached data retrieval and the operational efficiency of the business application. Attached Figure Description

[0042] Figure 1 This is a diagram illustrating the application environment of a data caching method in one embodiment.

[0043] Figure 2 This is a flowchart illustrating a data caching method in one embodiment;

[0044] Figure 3 This is a schematic diagram illustrating the principle of data caching in one embodiment;

[0045] Figure 4 This is a schematic diagram illustrating the principle of configuring initial configuration information in one embodiment;

[0046] Figure 5 This is a schematic diagram of the process of reading cached data in one embodiment;

[0047] Figure 6This is a structural block diagram of a data caching device in one embodiment;

[0048] Figure 7 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation

[0049] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0050] The data caching method provided in this application embodiment can be applied to, for example... Figure 1 In the application environment shown, terminal 102 can communicate with server 104 via a network. Both terminal 102 and server 104 can individually execute the data caching method provided in this embodiment, or they can execute it collaboratively. Taking the collaborative execution of the data caching method by terminal 102 and server 104 as an example, when terminal 102 starts a business application, it sends the target configuration information of the business application to server 104. Server 104 determines the call record of the target interface based on the path field; when the call record indicates that the target interface is called again, it performs an update type detection on the cache update field to obtain a type detection result. Server 104 is also used to read cached data from the server cache when the type detection result is the target type, and cache the cached data to the page cache. The page cache is used to provide cached data associated with the target page when terminal 102 displays the target page of the business application. Terminal 102 can be, but is not limited to, various personal computers, laptops, smartphones, tablets, and portable wearable devices, and server 104 can be implemented using a standalone server or a server cluster composed of multiple servers.

[0051] In one embodiment, such as Figure 2 As shown, a data caching method is provided, executed by the business side. The method is illustrated using a computer device as an example, where the computer device can provide... Figure 1 The terminal or server in the process includes the following steps:

[0052] Step 202: When the business application is started, obtain the target configuration information of the business application.

[0053] The target configuration information includes the target interface, path field, and cache update field. The target interface can be represented by the `apiName` field (interface name) or the `apiId` field (interface identifier). The path field can be represented by the `apiUrl` field. The cache update field can be represented by the `refreshFlag` field, which can be used to ignore the caching mechanism. The target configuration information is determined by the configuration client responding to the user's configuration operation. Each business application corresponds to an application identifier, such as `AppId`.

[0054] Specifically, such as Figure 3 As shown, Figure 3 This is a schematic diagram illustrating the principle of data caching. A computer device provides a browser that, when responding to a user's launch operation for a business application, retrieves pre-configured target configuration information based on the application's identifier. When there are multiple target interfaces, the target configuration information includes a path field and a cache update field for each target interface.

[0055] In one embodiment, reference Figure 3 As shown, the business side includes a server and a database; that is, the computer device includes a server and a database. When the computer device starts a business application, it initiates an information retrieval request, including an application identifier, to the configuration side. Based on the application identifier in the information retrieval request, the computer device determines the target configuration information corresponding to the application identifier and sends the target configuration information to the computer device's server. The server in the computer device can store the target configuration information in the database.

[0056] In one embodiment, reference Figure 3 As shown, computer devices also include page caching, which can be a type of web cache used to temporarily store web documents and data. For applications that require a large number of business accesses, web caching can enable fast access responses and reduce server latency.

[0057] Step 204: Determine the call record of the target interface based on the path field.

[0058] Specifically, before calling the target interface, the computer device needs to query whether the cached data corresponding to the target interface has been cached based on the path field. Therefore, it is necessary to determine the call record of the target interface. Specifically, when the cached data has been cached or when the target interface needs to be called, a call record is created for the target interface. The call record contains relevant information associated with each call to the target interface, such as the number of calls, the call time, whether the call was successful, and the configuration status.

[0059] Step 206: When the target interface of the call record is called again, perform update type detection on the cache update field to obtain the type detection result.

[0060] Specifically, a subsequent call indicates that the cached data corresponding to the target interface has been cached. At this point, the computer device needs to perform update type detection on the cache update field to determine whether the cached data corresponding to the target interface needs to be forcibly updated.

[0061] In one embodiment, after determining the call record of the target interface based on the path field, the method further includes: when the call record indicates that the target interface is being called for the first time, calling the target interface to read cached data from the database through the target interface; and caching the cached data to the page cache.

[0062] Specifically, the initial call indicates that the cached data corresponding to the target interface has not yet been fully cached. (See reference...) Figure 3 As shown, the computer device therefore needs to directly call the target interface to retrieve cached data from the database. At this point, the computer device can directly cache the retrieved cached data in the page cache.

[0063] In this embodiment, when the call record indicates that the target interface is being called for the first time, the cached data obtained when calling the target interface is quickly cached into the page cache, thereby improving the efficiency of data caching. At the same time, different data caching methods are adopted for different call records, thus improving the flexibility of data caching.

[0064] Step 208: If the type detection result is the target type, read the cached data from the server cache.

[0065] The target type can be a forced update type. A forced update indicates a process that requires updating cached data that has already been configured. Servers in computer devices also include server caches.

[0066] Specifically, the computer device needs to determine whether the cached data corresponding to the target interface exists in the server cache. If it exists, the computer device directly reads the cached data from the server cache. If it does not exist, the computer device directly calls the target interface to read the cached data from the database through the target interface.

[0067] In one embodiment, after performing update type detection on the cache update field and obtaining the type detection result, the method further includes: when the type detection result is not the target type, calling the target interface to read cached data from the database through the target interface and caching the cached data to the page cache.

[0068] Specifically, refer to Figure 3As shown, when the type detection result is not a forced update type, i.e., not the target type, the computer device can directly call the target interface to retrieve cached data from the database. In this case, the computer device can directly cache the retrieved cached data in the page cache.

[0069] In this embodiment, when the type detection result is not the target type, the cached data obtained when calling the target interface is quickly cached into the page cache, which improves the efficiency of data caching. At the same time, different data caching methods are adopted for different type detection results, thus improving the flexibility of data caching.

[0070] Step 210: Cache the cached data to the page cache.

[0071] Page caching is used to provide cached data associated with the target page when displaying the target page of the business application. The target page represents any one of multiple pages displayed when the business application is running.

[0072] Specifically, when cached data is cached to the page cache, the computer device can determine the current stage of the business application's operation and the multiple interfaces associated with the current stage, and then read the cached data associated with the multiple interfaces from the page cache and display the multiple cached data on the target page.

[0073] In the aforementioned data caching method, when the business application starts, the target configuration information of the business application is obtained, which includes the target interface, path field, and cache update field. Then, the call record of the target interface is determined based on the path field. When the call record indicates that the target interface is being called again, the update type of the cache update field is checked to obtain the type detection result. Thus, when the type detection result is the target type, cached data can be read from the server cache and cached in the page cache. Since the execution process is based on different call records after determining the target interface call record, compared to the traditional method of indiscriminately calling the interface, this application determines the cached data based on the type detection result when the call record indicates that the target interface is being called again, by checking the update type of the cache update field. Therefore, even if the mart interface call fails, the cached data can still be determined, improving the flexibility of obtaining the cached data corresponding to the business application. At the same time, since cached data is only read from the server cache when the type detection result is the target type, the accuracy of cached data acquisition is also ensured.

[0074] Furthermore, this application eliminates the need for repeated API calls and additional code development for the business application each time it starts. Instead, it directly provides cached data associated with the target page when displaying the target page of the business application through page caching, thereby improving the efficiency of cached data retrieval and the operational efficiency of the business application.

[0075] In one embodiment, before caching the cached data to the page cache, the method further includes: performing a validity check on the cached data based on the validity period to obtain a validity result; when the validity result indicates that the check is invalid, calling a target interface to read the cached data from the database through the target interface and caching the cached data to the page cache; caching the cached data to the page cache includes: caching the cached data to the page cache when the validity result indicates that the check is valid.

[0076] The target configuration information includes the validity period; the validity period can be reflected through the cacheTime field.

[0077] Specifically, when cached data corresponding to the target interface exists in the server cache, the computer device determines the cache duration for which the cached data is stored in the server cache. (Reference) Figure 3 As shown, the computer device performs validity checks on cached data based on the cache duration and validity period. When the cache duration is less than or equal to the validity period, the validity result is determined to be valid; when the cache duration is greater than the validity period, the validity result is determined to be invalid. When the validity result indicates that the data is valid, the computer device can directly cache the cached data to the page cache; when the validity result indicates that the data is invalid, the computer device calls the target interface to retrieve the cached data from the database and caches the retrieved cached data to the page cache.

[0078] In this embodiment, by performing validity checks on the cached data, the validity results can be accurately obtained. Then, different data caching methods can be adopted according to the validity results to cache the cached data in the page cache, thus improving the flexibility of data caching.

[0079] In one embodiment, the target configuration information also includes a synchronization field corresponding to the target interface. The synchronization field can be represented by the synsFlag field. The synchronization field is used to determine whether the cached data corresponding to the target interface is synchronized from the test environment to the production environment.

[0080] In one embodiment, before obtaining the target configuration information of the business application, the method further includes: determining the business module corresponding to the business application; obtaining the initial configuration information corresponding to the business module; and determining the target configuration information corresponding to the business application based on multiple field information.

[0081] The business module includes at least one sub-module; the initial configuration information includes multiple interfaces corresponding to each sub-module, as well as field information corresponding to each interface; the sub-module can be regarded as a business module.

[0082] Specifically, since each business application typically includes multiple business modules, and each business module includes multiple interfaces and corresponding field information for each interface, the computer device needs to configure the newly added business application through a configuration terminal before obtaining the target configuration information of the business application. This requires configuring the interfaces and their field information within the business modules to obtain the initial configuration information corresponding to the business application. The configured initial configuration information takes effect immediately. Figure 4 As shown, Figure 4 A schematic diagram illustrating the principle of configuring initial configuration information.

[0083] The configuration module may include a visual configuration interface caching system. This system allows users to flexibly add, modify, and delete different interfaces according to their needs. It allows setting cache levels, cache durations, refresh mechanisms, expiration mechanisms, and configuring pre-launch and pre-decommissioning times for interfaces. All information configured through the visual configuration interface caching system can be displayed through the corresponding field information of the interface.

[0084] However, when starting a business application, not all information in the initial configuration settings may be valid or usable. Therefore, the configuration server needs to filter the initial configuration information based on the fields in the initial configuration settings to obtain the target configuration information corresponding to the business application. This allows the configuration server to send the target configuration information to the computer device, where it is stored in a database via a server.

[0085] In one embodiment, the configuration terminal can directly send the initial configuration information to the computer device, which can then filter the initial configuration information based on the field information in the initial configuration information to obtain the target configuration information corresponding to the business application.

[0086] In one embodiment, the user can also pre-assign a corresponding interface name to each interface through the configuration terminal, such as order list, order details, etc.

[0087] In this embodiment, by pre-configuring newly added business applications through the configuration terminal, the initial configuration information corresponding to the business applications can be flexibly obtained and visualized. When the business application starts, the corresponding business module can be quickly identified, and the target configuration information can be accurately filtered from the initial configuration information using multiple fields in the business module, thus improving the execution efficiency of the business application. Furthermore, since the target configuration information is sent to the computer device only when the business application starts, bandwidth is saved on both the configuration terminal and the business terminal, and server resource consumption costs are reduced.

[0088] Meanwhile, this application achieves centralized management of business applications by combining configuration and business side approaches. It systematizes and automates the entire process of determining and querying cached data, from interface configuration, invocation, and recording, thereby improving the efficiency of cached data retrieval.

[0089] In one embodiment, the target configuration information corresponding to the business application is determined based on multiple field information, including: for each field information, if the interface status in the current field information is online, the current field information and the corresponding current interface are used as sub-configuration information; if the interface status in the current field information is pre-launched, the current time for obtaining the initial configuration information is determined; if the current time and the pre-launch time meet a preset condition, the current field information and the corresponding current interface are used as sub-configuration information.

[0090] The field information includes interface status and pre-launch time; the target configuration information includes multiple sub-configuration information; and the interface status includes online status, pre-launch status, and offline status.

[0091] Specifically, taking the filtering of initial configuration information by a computer device as an example, the computer device determines the current field information corresponding to the current interface. If the interface status in the current field information is offline, then the current field information cannot be used as sub-configuration information. If the interface status in the current field information is online, then both the current field information and the corresponding current interface are used as sub-configuration information. If the interface status in the current field information is pre-online, the computer device needs to determine the current time of obtaining the initial configuration information. It's easy to understand that the current time is usually earlier than the pre-online time corresponding to the current interface. If the time difference between the current time and the pre-online time is less than a preset threshold, both the current field information and the corresponding current interface can still be used as sub-configuration information. Therefore, the computer device integrates multiple sub-configuration information to obtain the filtered target configuration information.

[0092] In this embodiment, by determining the interface status corresponding to each of the multiple interfaces, the target configuration information required for the business application to run can be accurately filtered out, avoiding unnecessary interface calls and ensuring the accuracy of subsequent caching of cached data.

[0093] In one embodiment, such as Figure 5 As shown, calling the target interface to read cached data from the database includes the following steps:

[0094] Step 502: Determine the target data source and interface type corresponding to the target interface, and determine the data reading method based on the interface type.

[0095] The target configuration information also includes the data source identifier and interface type corresponding to the target interface; the interface type includes database type and script type, and the script type can be Python script, PHP script, etc.

[0096] Specifically, the computer device determines the data source field table corresponding to the data source identifier. This data source field table is determined through pre-configuration of the data source identifier and includes the connection address. The connection address can be the `sqlalchemy_uri` field. In other words, the computer device can accurately obtain the target data source from the data warehouse using the connection address, enabling rapid location of the target data source within the data warehouse.

[0097] Furthermore, the computer device determines the interface type of the target interface. When the interface type is a database type, the data is read using SQL query statements. When the interface type is a script type, the data can be read by logging into the remote target container via the target protocol, or by directly executing the script code corresponding to the target interface to complete the data reading through the script code.

[0098] Step 504: Call the target interface to query the target data source through data reading and obtain the cached data corresponding to the target interface.

[0099] Specifically, the computer device executes a call to the target interface, triggering the target interface to query the target data source through different data reading methods. When the data reading method is to directly execute the script code corresponding to the target interface, the script code is configured with the reading path of the target data source associated with the target interface. When the script code is executed, it can query the target data source to obtain the cached data corresponding to the target interface.

[0100] When the interface type is database type, the computer device can respond to the user's data read operation, obtain initial query parameters, and use the standard format of the target interface as auxiliary parameters. The standard format of the target interface includes, but is not limited to, `public interface interface_name { / / interface content}`, etc. The computer device concatenates the initial query parameters and auxiliary parameters to obtain target query parameters that conform to the database query format, where the target query parameters can be a database query SQL statement. Using the target query parameters, the computer device can then query the target data source and obtain the cached data corresponding to the target interface.

[0101] When the target data source is deployed in a target container, the computer device needs to establish a communication connection with the target container in advance via the target protocol. When the computer device triggers an operation on the target container, it can query the target data source through the remotely connected target container, obtain the cached data corresponding to the target interface, and send the cached data to the computer device.

[0102] In this embodiment, by determining the interface type corresponding to the target interface, different data reading methods can be identified, thus improving the flexibility and diversity of reading cached data. Specifically, for the database type interface, users can flexibly perform data reading operations during the operation of business applications, enabling the display of corresponding cached data while the business application is running, thereby improving the convenience of cached data reading. For the script type target interface, data query can be achieved by providing a remote connection, realizing the isolation and rapid deployment of business applications and reducing the difficulty of interface calls.

[0103] It should be understood that although the steps in the flowcharts of the above embodiments are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the above embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.

[0104] Based on the same inventive concept, this application also provides a data caching device for implementing the data caching method described above. The solution provided by this device is similar to the implementation described in the above method; therefore, the specific limitations in one or more data caching device embodiments provided below can be found in the limitations of the data caching method described above, and will not be repeated here.

[0105] In one embodiment, such as Figure 6 As shown, a data caching device 600 is provided, including: a configuration information determination module 602, an update type detection module 604, and a cached data determination module 606, wherein:

[0106] The configuration information determination module 602 is used to obtain the target configuration information of the business application when the business application is started; the target configuration information includes the target interface, path field and cache update field.

[0107] The update type detection module 604 is used to determine the call record of the target interface based on the path field; when the call record indicates that the target interface is called again, the update type detection is performed on the cache update field to obtain the type detection result.

[0108] The cache data determination module 606 is used to read cache data from the server cache when the type detection result is the target type; cache the cache data to the page cache; the page cache is used to provide cache data associated with the target page when displaying the target page of the business application.

[0109] In one embodiment, the configuration information determination module 602 is further configured to determine the business module corresponding to the business application; the business module includes at least one sub-module; obtain the initial configuration information corresponding to the business module; the initial configuration information includes multiple interfaces corresponding to each sub-module and field information corresponding to each interface; and determine the target configuration information corresponding to the business application based on the multiple field information.

[0110] In one embodiment, the configuration information determination module 602 is further configured to, for each of the multiple field information, if the interface status in the current field information is online, use the current field information and the corresponding current interface as sub-configuration information; if the interface status in the current field information is pre-online, determine the current time for obtaining the initial configuration information; determine the difference between the current time and the pre-online time, and if the difference meets a preset condition, use the current field information and the corresponding current interface as sub-configuration information.

[0111] In one embodiment, the update type detection module 604 is further configured to call the target interface when the call record indicates that the target interface is being called for the first time, so as to read cached data from the database through the target interface; and cache the cached data to the page cache.

[0112] In one embodiment, the update type detection module 604 is further configured to call the target interface when the type detection result is not the target type, so as to read cached data from the database through the target interface and cache the cached data to the page cache.

[0113] In one embodiment, the data caching device 600 further includes a validity detection module 608, which is used to perform validity detection on the cached data according to the validity period and obtain a validity result; when the validity result indicates that the detection is invalid, the target interface is called to read the cached data from the database through the target interface and cache the cached data to the page cache; when the validity result indicates that the detection is valid, the cached data is cached to the page cache.

[0114] In one embodiment, the data caching device 600 further includes an interface calling module 610, which is used to determine the target data source and interface type corresponding to the target interface, and determine the data reading method according to the interface type; and call the target interface to query the target data source through the data reading method to obtain the cached data corresponding to the target interface.

[0115] Each module in the aforementioned data caching device 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, or stored in the memory of a computer device as software, so that the processor can call and execute the operations corresponding to each module.

[0116] In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 7As shown, this computer device includes a processor, memory, input / output interfaces (I / O), a communication interface, a display unit, and input devices. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface, display unit, and input devices are also connected to the system bus via the I / O interfaces. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The I / O interfaces are used for exchanging information between the processor and external devices. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, NFC (Near Field Communication), or other technologies. When the computer program is executed by the processor, it implements a data caching method. The display unit of the computer device is used to form a visually visible image. It can be a display screen, a projection device, or a virtual reality imaging device. The display screen can be an LCD screen or an e-ink screen. The input device of the computer device can be a touch layer covering the display screen, or buttons, trackballs, or touchpads set on the casing of the computer device, or external keyboards, touchpads, or mice, etc.

[0117] Those skilled in the art will understand that Figure 7 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0118] In one embodiment, a computer device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above-described method embodiments.

[0119] In one embodiment, a computer-readable storage medium is provided storing a computer program that, when executed by a processor, implements the steps in the above-described method embodiments.

[0120] In one embodiment, a computer program product or computer program is provided, comprising computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the steps described in the method embodiments above.

[0121] 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. When executed, the computer program can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. 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). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.

[0122] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0123] The above embodiments are merely illustrative of several implementation methods of this application, and their descriptions are relatively specific and detailed. However, they should not be construed as limiting the scope of this application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.

Claims

1. A data caching method, characterized in that, The method includes: When a business application is started, the target configuration information of the business application is obtained based on the application identifier of the business application; the target configuration information includes a target interface, a path field, and a cache update field; the cache update field is used to ignore the cache mechanism. The call record of the target interface is determined based on the path field; the call record contains relevant information associated with each call to the target interface; When the call record indicates that the target interface is called again, the update type of the cache update field is checked to obtain the type check result; When the type detection result is a forced update type, read cached data from the server cache; when the type detection result is not the forced update type, call the target interface to read cached data from the database through the target interface. The cached data is cached in the page cache; the page cache is used to temporarily store web documents and data, and provides cached data associated with the target page when displaying the target page of the business application.

2. The method according to claim 1, characterized in that, Before obtaining the target configuration information of the business application, the method further includes: Determine the business module corresponding to the business application; the business module includes at least one sub-module; Obtain the initial configuration information corresponding to the business module; the initial configuration information includes multiple interfaces corresponding to each sub-module, and field information corresponding to each interface; Based on the information from multiple fields, the target configuration information corresponding to the business application is determined.

3. The method according to claim 2, characterized in that, The field information includes interface status and pre-launch time; the target configuration information includes multiple sub-configuration information; determining the target configuration information corresponding to the business application based on the multiple fields includes: For each field in the multiple fields of information, if the interface status in the current field of information is online, the current field of information and the corresponding current interface are used as sub-configuration information. When the interface status in the current field information is in the pre-launch state, determine the current time for obtaining the initial configuration information; If the current time and the pre-launch time meet preset conditions, then the current field information and the corresponding current interface will be used as sub-configuration information.

4. The method according to claim 1, characterized in that, After determining the call record of the target interface based on the path field, the method further includes: When the call record indicates that the target interface is being called for the first time, the target interface is called to read cached data from the database through the target interface; The cached data is cached in the page cache.

5. The method according to claim 1, characterized in that, The target configuration information also includes a validity period; before caching the cached data to the page cache, the method further includes: Based on the specified validity period, the cached data is subjected to validity testing to obtain a validity result; When the validity result characterization detection is invalid, the target interface is invoked to read cached data from the database through the target interface and cache the cached data to the page cache; The step of caching the cached data to the page cache includes: When the validity result indicates that the detection is valid, the cached data is cached to the page cache.

6. The method according to any one of claims 4 to 5, characterized in that, The invocation of the target interface to read cached data from the database through the target interface includes: Determine the target data source and interface type corresponding to the target interface, and determine the data reading method based on the interface type; The target interface is invoked to query the target data source using the data reading method, thereby obtaining the cached data corresponding to the target interface.

7. A data caching device, characterized in that, The device includes: The configuration information determination module is used to obtain the target configuration information of the business application based on the application identifier of the business application when the business application is started; the target configuration information includes a target interface, a path field, and a cache update field; the cache update field is used to ignore the cache mechanism. An update type detection module is used to determine the call record of the target interface based on the path field; the call record contains relevant information associated with each call to the target interface; when the call record indicates that the target interface is called again, the cache update field is updated with an update type detection to obtain a type detection result; The cached data determination module is used to read cached data from the server cache when the type detection result is a forced update type; and to call the target interface to read cached data from the database through the target interface when the type detection result is not the forced update type; and to cache the cached data to the page cache; the page cache is used to temporarily store web documents and data, and to provide cached data associated with the target page when displaying the target page of the business application.

8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 6.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.

10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Method and device for data caching and computer processing equipment

    CN107451236A

  • Method and device for caching interface to return data

    CN109086421A