Application resource caching method and device, computer equipment, readable storage medium and program product

By generating the use request of the web application, determining the resource list, and classifying the resources in the local cache according to the preset strategy, the problem of low browser download resources is solved, and efficient caching and rapid operation of web application is achieved.

CN120336653APending Publication Date: 2025-07-18CHINA TELECOM CLOUD TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510467730.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-15
Publication Date
2025-07-18

AI Technical Summary

Technical Problem

There is a limit on the number of concurrency when downloading web application resources by the browser, resulting in slow resource download efficiency.

Method used

Generate the use request of the web application, determine the resource list, and store the target resources in the local cache, classify the resources according to the preset strategy, including the API class, CSS class, JavaScript class and HTML class, and use the resource modification frequency to sort and update.

Benefits of technology

Improve the caching efficiency of web application resources, reduce duplicate downloads, and improve the application running speed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120336653A_ABST
    Figure CN120336653A_ABST
Patent Text Reader

Abstract

The invention relates to an application resource caching method and device, computer equipment, a computer readable storage medium and a program product. The method comprises the following steps: generating a use request of a webpage application, and determining a resource list corresponding to the use request; sending the use request to a server, and intercepting resources correspondingly returned by the server according to the resource list; when the target resource corresponding to the resource list does not exist in the local cache or the target resource needing to be updated exists in the local cache, intercepting the target resource from the resources according to a preset resource strategy, and storing the target resource in a preset resource category in the local cache; and running the webpage application based on the target resource and the resource corresponding to the resource list existing in the local cache. By adopting the method, the resource caching efficiency of the webpage application can be effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of web applications, and in particular, to an application resource caching method, apparatus, computer device, computer-readable storage medium, and computer program product. Background Art

[0002] With the development of Internet technology, the form of software applications has long shifted from the traditional client / server architecture to the browser / server architecture.

[0003] In the related art, when using an application, a user can experience it on any device with a browser and network. Since the resources of web applications are rich in sources and large in quantity, and there is a limit on the number of concurrent downloads in browser resource downloads, each time the application is opened, it is accompanied by a long network download process, resulting in slow resource download efficiency. Summary of the Invention

[0004] Based on this, in view of the above technical problems, it is necessary to provide an application resource caching method, apparatus, computer device, computer-readable storage medium, and computer program product that can improve the caching efficiency of application resources.

[0005] In a first aspect, this application provides an application resource caching method, which is applied to a target client and includes:

[0006] Generate a usage request for a web application and determine a resource list corresponding to the usage request;

[0007] Send the usage request to a server and intercept the resources returned by the server according to the resource list;

[0008] In the case where the target resources corresponding to the resource list do not exist in the local cache or there are target resources that need to be updated, intercept the target resources from the resources according to a preset resource policy and store them in a preset resource category in the local cache; the preset resource category includes api, css, JavaScript, and html;

[0009] Run the web application based on the target resources and the resources corresponding to the resource list that already exist in the local cache.

[0010] In one embodiment, the method further includes:

[0011] Obtain the request header of each resource corresponding to the resource list and the modification information included in the request header for each resource; the modification information includes the modification times and modification time points of the resources;

[0012] Determine the modification frequency of each resource based on the modification information;

[0013] Sort the resources corresponding to the resource list in ascending order based on the modification frequency to obtain a first-order list, and store the resources locally in sequence according to the first-order list.

[0014] In one embodiment, the intercepting the target resources from the resources according to a preset resource policy includes:

[0015] For the target resources of the api class and the html class, intercept them from the resources each time.

[0016] For the target resources of the css class and the JavaScript class, intercept them from the resources when the target resources corresponding to the resource list do not exist in the local cache.

[0017] In one embodiment, the method further includes:

[0018] When all the resources corresponding to the resource list exist in the local cache and there are no resources to be updated, run the web application based on the fact that all the resources corresponding to the resource list exist in the local cache.

[0019] In a second aspect, the present application further provides an application resource caching method, which is applied to a server and includes:

[0020] Receive a usage request sent by a target client, and determine the resource list corresponding to the usage request;

[0021] Send the resource list to a development client, receive the resources packaged by the development client according to a preset naming rule, intercept the corresponding resources from the resources according to a preset policy, and store them under a preset resource category in the local cache;

[0022] Send the resources to the target client; the preset naming rule is to calculate the hash value of each resource and name each resource according to the hash value; the preset resource category includes html class, css class, JavaScript class, picture and video class, and cache script class.

[0023] In one embodiment, the intercepting the corresponding resources from the resources according to a preset policy includes:

[0024] For the resources of the cache script class and the html class, intercept them from the corresponding resources each time.

[0025] For the resources of the css class, JavaScript class, and picture and video class, intercept them from the corresponding resources when they do not exist in the local cache.

[0026] In one embodiment, storing into a preset resource category in the local cache includes:

[0027] For resources of the html type and cache script type, storing them in the local cache is prohibited;

[0028] For resources of the css type, JavaScript type, and picture / video type, according to a preset storage rule, set corresponding storage durations.

[0029] In a third aspect, the present application further provides an application resource caching device, which is applied to a target client and includes:

[0030] A determination module, configured to generate a usage request for a web application and determine a resource list corresponding to the usage request;

[0031] An interception module, configured to send the usage request to a server and intercept the resources returned by the server according to the resource list;

[0032] A storage module, configured to, when a target resource corresponding to the resource list does not exist in the local cache or there is a target resource that needs to be updated, extract the target resource from the resources according to a preset resource policy and store it into a preset resource category in the local cache; the preset resource category includes api type, css type, JavaScript type, and html type;

[0033] An operation module, configured to run the web application based on the target resource and the resources corresponding to the resource list that already exist in the local cache.

[0034] In a fourth aspect, the present application further provides an application resource caching device, which is applied to a server and includes:

[0035] A determination module, configured to receive a usage request sent by a target client and determine a resource list corresponding to the usage request;

[0036] A storage module, configured to send the resource list to a development client, receive the resources packaged by the development client according to a preset naming rule, extract the corresponding resources from the resources according to a preset policy, and store them into a preset resource category in the local cache;

[0037] A sending module, configured to send the resources to the target client; the preset naming rule is to calculate the hash value of each resource and name each resource according to the hash value; the preset resource category includes html type, css type, JavaScript type, picture / video type, and cache script type.

[0038] Fifth aspect, the present application further provides a computer device, including a memory and a processor, where the memory stores a computer program, and when the processor executes the computer program, the steps described in the first aspect or the second aspect are implemented.

[0039] Sixth aspect, the present application further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps described in the first aspect or the second aspect are implemented.

[0040] Seventh aspect, the present application further provides a computer program product, including a computer program, and when the computer program is executed by a processor, the steps described in the first aspect or the second aspect are implemented.

[0041] For the above application resource caching method, device, computer device, computer-readable storage medium and computer program product, first, generate a usage request for a web application and determine a resource list corresponding to the usage request; send the usage request to the server and intercept the resources returned by the server according to the resource list; in the case that the target resources corresponding to the resource list do not exist in the local cache or there are target resources that need to be updated, extract the target resources from the resources according to a preset resource policy and store them in a preset resource category in the local cache; based on the target resources and the resources corresponding to the resource list already existing in the local cache, run the web application. In this way, by updating and storing the resources in the local cache according to the preset resource policy, when the web application needs to be run next time, directly call the unchanged resources stored in the local cache and only download the updated part of the resources, which improves the caching efficiency of the web application resources. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the following will briefly introduce the drawings required for use in the description of the embodiments of the present application or related technologies. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other related drawings can also be obtained based on these drawings.

[0043] Figure 1 It is an application environment diagram of the application resource caching method in an embodiment;

[0044] Figure 2 It is a schematic flowchart of the application resource caching method applied to a target client in an embodiment;

[0045] Figure 3 It is a schematic flowchart of the application resource caching method applied to a server in an embodiment;

[0046] Figure 4Block diagram of an application resource caching device applied to a target client in an embodiment

[0047] Figure 5 Block diagram of an application resource caching device applied to a server in an embodiment

[0048] Figure 6 Internal structure diagram of a computer device in an embodiment Detailed implementation manners

[0049] To make the objectives, technical solutions and advantages of the present application clearer and more understandable, the present application will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application

[0050] The application resource caching method provided by the embodiments of the present application can be applied to an application environment as shown in Figure 1 Among them, the target client 102 communicates with the server 104 through a network. The data storage system can store the data that the server 104 needs to process. The data storage system can be integrated on the server 104, or can be placed in the cloud or other network servers. Among them, the target client 102 can be, but is not limited to, various personal computers, laptop computers, smart phones, tablet computers, Internet of Things devices and portable wearable devices. The Internet of Things devices can be smart speakers, smart TVs, smart air conditioners, smart vehicle-mounted devices, projection devices, etc. The portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc. The head-mounted device can be a virtual reality (VR) device, an augmented reality (AR) device, smart glasses, etc. The target client 102 can also be a browser on the above devices

[0051] The server 104 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services

[0052] In one embodiment, after the development client completes the development of the web application, it sends the corresponding resources to the server. When the target client needs to use the web application, it downloads the resources from the server correspondingly

[0053] In an exemplary embodiment, as shown in Figure 2 An application resource caching method is provided. Taking the method applied to the target client 102 in Figure 1 as an example, the following steps 202 to 208 are included. Among them

[0054] Step 202: Generate a usage request for the web application and determine the resource list corresponding to the usage request;

[0055] Among them, a web application is an application program that runs in a web browser, and users can directly use the application program on the web browser by running the resources directly.

[0056] Exemplarily, the target client determines the web application to be used, generates a usage request for the web application, and determines the resources to be used when using the web application, so as to determine the resource list corresponding to the usage request.

[0057] Step 204: Send the usage request to the server and intercept the resources returned by the server according to the resource list.

[0058] Optionally, the target client sends the usage request to the server and intercepts the resources returned by the server according to the resource list through a script.

[0059] Step 206: In the case where the target resources corresponding to the resource list do not exist in the local cache or there are target resources that need to be updated, intercept the target resources from the resources according to the preset resource policy and store them under the preset resource categories in the local cache.

[0060] Among them, the preset resource categories include api categories, css categories, JavaScript categories, and html categories.

[0061] Exemplarily, in the case where the target resources corresponding to the resource list do not exist in the local cache of the target client or there are target resources that need to be updated, intercept the target resources from the resources according to the preset resource policy and store them under the api categories, css categories, JavaScript categories, and html categories in the local cache of the target client.

[0062] Among them, api category resources refer to various resources and services related to api (application programming interface); css category resources refer to various tools, frameworks, preprocessors, code style guides, etc. for developing and managing CSS (Cascading Style Sheets), and can specifically be style files; JavaScript category resources are script files; html category resources are application entrances.

[0063] Step 208: Run the web application based on the target resources and the resources corresponding to the resource list already existing in the local cache.

[0064] Optionally, run the web application according to the target resources and the resources corresponding to the resource list already existing in the local cache.

[0065] In the above application resource caching method, a usage request for a web application is generated, and a resource list corresponding to the usage request is determined; the usage request is sent to a server, and resources returned by the server corresponding to the resource list are intercepted; in a case where a target resource corresponding to the resource list does not exist in the local cache or there is a target resource that needs to be updated, according to a preset resource policy, the target resource is intercepted from the resources and stored in a preset resource category in the local cache; based on the target resource and the resources corresponding to the resource list already existing in the local cache, the web application is run. In this way, by updating and storing resources in the local cache according to the preset resource policy, when the web application needs to be run next time, the unchanged resources stored in the local cache can be directly called, and only the updated part of the resources needs to be downloaded, improving the caching efficiency of the web application resources.

[0066] In an exemplary embodiment, the application resource caching method further includes: obtaining a request header for each resource corresponding to the resource list, and modification information included in the request header for each resource; the modification information includes the modification times and modification time points of the resources; based on the modification information, determining the modification frequency of each resource; based on the modification frequency, sorting the resources corresponding to the resource list from smallest to largest to obtain a first sorted list, and storing the resources locally in sequence according to the first sorted list.

[0067] In actual implementation, obtain the request header for each resource corresponding to the resource list, read the hash information carried in the request header, obtain the modification times and modification time points of each resource according to the hash information, determine the modification frequency of each resource, based on the modification frequency, sort the resources corresponding to the resource list from smallest to largest to obtain a first sorted list, and store the resources locally in sequence according to the first sorted list.

[0068] In some embodiments, obtain the shortest time and the longest time for each resource modification, take the average value, and replace the default storage duration of the corresponding resource in the cache with the average value.

[0069] In the above embodiments, under normal circumstances, resources need to be cached from the server, and a high modification frequency means being modified multiple times. By preferentially caching resources with a higher modification frequency, automatic optimization of dynamic cached resources can be achieved, improving the caching efficiency of application resources.

[0070] In an exemplary embodiment, intercepting the target resource from the resources according to the preset resource policy includes: for target resources of the api type and html type, intercepting from the resources each time; for target resources of the css type and JavaScript type, intercepting from the resources in a case where the target resource corresponding to the resource list does not exist in the local cache.

[0071] In actual implementation, for the target resources of the API class and HTML class, they are intercepted from the resources each time; for the target resources of the CSS class and JavaScript class, when the target resources corresponding to the resource manifest do not exist in the local cache, they are intercepted from the resources.

[0072] In one embodiment, for the target resources of the CSS class and JavaScript class, when the target resources corresponding to the version of the resource manifest do not exist in the local cache, they are intercepted from the resources, and the target resources of the old version in the local cache are updated.

[0073] In another embodiment, for the target resources of the HTML class, they are intercepted from the resources each time. When the web application supports offline use, the target resources of the HTML class can be cached locally.

[0074] In the above embodiments, different strategies are used for different categories of resources to ensure that the finally obtained resources are accurate, thus ensuring the normal operation of the web application.

[0075] In an exemplary embodiment, the application resource caching method further includes: when all the resources corresponding to the resource manifest exist in the local cache and there are no resources to be updated, based on the fact that all the resources corresponding to the resource manifest exist in the local cache, the web application is run.

[0076] In actual implementation, when all the resources corresponding to the resource manifest exist in the local cache and all the resources have no updates, based on the fact that all the resources corresponding to the resource manifest exist in the local cache, the web application is run.

[0077] In the above embodiments, when the resources of the web application do not need to be redownloaded, by directly calling the resources in the target client, the web application is run, which improves the running efficiency.

[0078] In an exemplary embodiment, as Figure 3 shown, an application resource caching method is provided. Taking the method applied to Figure 1 the server 104 as an example, it includes the following steps 302 to 306. Among them:

[0079] Step 302, receive the usage request sent by the target client and determine the resource manifest corresponding to the usage request.

[0080] Exemplarily, the server receives the usage request sent by the target client and determines the resource manifest corresponding to the usage request.

[0081] Step 304: Send the resource list to the development client, receive the resources packaged by the development client according to the preset naming rule, intercept the corresponding resources according to the preset policy, and store them under the preset resource categories in the local cache.

[0082] Among them, the development client is the client for users to design web applications; the preset naming rule is to calculate the hash value of each resource and name each resource according to the hash value; the preset resource categories include html category, css category, JavaScript category, picture and video category, and cache script category.

[0083] Send the resource list to the development client, receive the resources packaged by the development client according to the preset naming rule, intercept the corresponding resources according to the preset policy, and store them under the html category, css category, JavaScript category, picture and video category, and cache script category in the local cache.

[0084] Among them, the picture and video category resources refer to the media resources in the web application; the cache script category resources refer to the scripts used to manage the JavaScript category resources.

[0085] In one embodiment, after the web application design is completed by the development client, the resources are divided into multiple small resources, the hash value of each small resource is calculated, and the corresponding hash value is used to name each small resource to represent the versions of different small resources. The preset packaging method is used to package each renamed small resource, and the packaged resources are sent to the server.

[0086] Among them, the preset packaging method can be webpack (a static module packaging tool), or other packaging methods, and this application does not limit this.

[0087] Step 306: Send the resources to the target client.

[0088] Exemplarily, after storing the resources, the server sends the resources to the target client according to the resource list.

[0089] In the above embodiments, by sending the resource list to the development client and receiving the resources packaged according to the preset naming rule, the efficiency and consistency of the resources during transmission and storage can be ensured.

[0090] In an exemplary embodiment, intercepting the corresponding resources according to the preset policy includes: for the resources of the cache script category and the html category, intercept from the corresponding resources each time; for the resources of the css category, JavaScript category, and picture and video category, intercept from the corresponding resources when they do not exist in the local cache.

[0091] In actual implementation, for resources of the cache script type and the html type, they are intercepted from the corresponding resources each time; for resources of the css type, the JavaScript type, and the picture / video type, in the case where the target resources corresponding to the resource manifest do not exist in the local cache, they are intercepted from the resources.

[0092] In one embodiment, for resources of the css type, the JavaScript type, and the picture / video type, in the case where the target resources corresponding to the version of the resource manifest do not exist in the local cache, they are intercepted from the corresponding resources, and the resources of the old version in the local cache are updated.

[0093] In the above embodiments, different strategies are used for resources of different categories to ensure that the finally obtained resources meet the conditions, thus ensuring the normal operation of the web application.

[0094] In an exemplary embodiment, storing in the preset resource category in the local cache includes: for resources of the html type and the cache script type, storing in the local cache is prohibited; for resources of the css type, the JavaScript type, and the picture / video type, according to the preset storage rules, the corresponding storage duration is set.

[0095] In actual implementation, for resources of the html type and the cache script type, storing in the local cache is prohibited; for resources of the css type, the JavaScript type, and the picture / video type, according to the preset storage rules, the corresponding storage duration is set. For example, the cache duration of css type resources is not less than 14 days, and the cache duration of picture / video type resources is not less than 30 days, etc. The storage durations of different categories can be set according to specific circumstances, and the embodiments of the present application do not limit this.

[0096] In the above embodiments, different storage strategies are used for resources of different categories to ensure that the storage duration of the resources is most suitable for the usage environment of the web application.

[0097] To illustrate in detail the application resource caching method in the present application, an embodiment is used for illustration below. Exemplarily, the present application illustrates the application resource caching method in the usage scenario of a specific web application.

[0098] First, the target client determines the web application to be used, generates a usage request for the web application, and determines the resources to be used when using the web application, so as to determine the resource manifest corresponding to the usage request.

[0099] The target client sends the usage request to the server, and the server receives the usage request sent by the target client and determines the resource manifest corresponding to the usage request.

[0100] Send the resource list to the development client, receive the resources packaged by the development client according to the preset naming rules, extract the corresponding resources according to the preset policy, and store them in the local cache under html, css, JavaScript, image / video, and cache script categories.

[0101] After storing the resources, the server sends the resources to the target client according to the resource list.

[0102] The target client intercepts the resources returned by the server according to the resource list through a script.

[0103] In the case where the target resources corresponding to the resource list do not exist in the local cache of the target client, or there are target resources that need to be updated, extract the target resources from the resources according to the preset resource policy, and store them in the local cache of the target client under api, css, JavaScript, and html categories. Run the web application according to the target resources and the resources corresponding to the existing resource list in the local cache.

[0104] In the case where all the resources corresponding to the resource list exist in the local cache and none of the resources need to be updated, run the web application based on all the resources corresponding to the resource list existing in the local cache.

[0105] This application names the resources using the hash values of the resources, effectively solving the problem that when the number of requests is too large, the cost of comparing requests is relatively high. For web applications with a large number of referenced resources and infrequent version changes, it can greatly reduce the number of file comparisons and reduce the resource download of hash files with the same content. The cache update method using dynamic resource marking can dynamically adjust high-frequency requests and also achieve an acceleration effect for newly introduced resources.

[0106] It should be understood that although the steps in the flowcharts involved in the above-described embodiments are shown in sequence according to the arrows, these steps do not necessarily need to be executed in the order indicated by the arrows. Unless there is a clear description in this article, the execution of these steps has no strict order limit, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-described embodiments may include multiple steps or multiple stages. These steps or stages do not necessarily need to be executed at the same time, but can be executed at different times. The execution order of these steps or stages does not necessarily need to be sequential, but can be executed alternately or in turn with at least a part of other steps or steps or stages in other steps.

[0107] Based on the same inventive concept, an embodiment of the present application further provides an application resource caching device for implementing the application resource caching method involved above. The solution provided by this device to solve the problem is similar to the solution described in the above method. Therefore, the specific limitations in one or more embodiments of the application resource caching device provided below can refer to the limitations on the application resource caching method in the above text, and will not be repeated here.

[0108] In an exemplary embodiment, as Figure 4 shown, an application resource caching device is provided, which is applied to a target client and includes: a determination module 401, an interception module 402, a storage module 403, and a running module 404, where:

[0109] The determination module is used to generate a usage request for a web application and determine a resource list corresponding to the usage request.

[0110] The interception module is used to send the usage request to the server and intercept the resources returned by the server according to the resource list.

[0111] The storage module is used to, in the case where the target resources corresponding to the resource list do not exist in the local cache or there are target resources that need to be updated, intercept the target resources from the resources according to a preset resource policy and store them in a preset resource category in the local cache; the preset resource category includes api category, css category, JavaScript category, and html category.

[0112] The running module is used to run the web application based on the target resources and the resources corresponding to the resource list that already exist in the local cache.

[0113] In some embodiments, the above storage module is further used to obtain the request headers of each resource corresponding to the resource list and the modification information included in the request headers; the modification information includes the modification times and modification time points of the resources;

[0114] Based on the modification information, determine the modification frequency of each resource;

[0115] Based on the modification frequency, sort the resources corresponding to the resource list from small to large to obtain a first-order list, and store the resources locally in sequence according to the first-order list.

[0116] In some embodiments, the device further includes an interception module, which is used to intercept the target resources of the api category and html category from the resources every time;

[0117] For the target resources of the css category and JavaScript category, intercept them from the resources in the case where the target resources corresponding to the resource list do not exist in the local cache.

[0118] In some embodiments, the above-mentioned running module is further configured to run the web application based on all the resources corresponding to the resource manifest existing in the local cache and in the case that there is no resource to be updated.

[0119] In an exemplary embodiment, as Figure 5 shown, there is provided an application resource caching device applied to a server, including: a determination module 501, a storage module 502, and a sending module 503, wherein:

[0120] The determination module is configured to receive a usage request sent by a target client and determine the resource manifest corresponding to the usage request.

[0121] The storage module is configured to send the resource manifest to a development client, receive the resources packaged by the development client according to a preset naming rule, intercept the corresponding resources according to a preset policy, and store them in a preset resource category in the local cache.

[0122] The sending module is configured to send the resources to the target client; the preset naming rule is to calculate the hash value of each resource and name each resource according to the hash value; the preset resource categories include html category, css category, JavaScript category, picture and video category, and cache script category.

[0123] In some embodiments, the device further includes an interception module, which is configured to intercept from the corresponding resources each time for the resources of the cache script category and the html category;

[0124] For the resources of the css category, JavaScript category, and picture and video category, intercept from the corresponding resources in the case that they do not exist in the local cache.

[0125] In some embodiments, the above-mentioned storage module is further configured to prohibit storing the resources of the html category and the cache script category in the local cache;

[0126] For the resources of the css category, JavaScript category, and picture and video category, set the corresponding storage duration according to a preset storage rule.

[0127] Each module in the above-mentioned application resource caching device can be implemented in whole or in part by software, hardware, and their combination. The above-mentioned modules can be embedded in or independent of a processor in a computer device in the form of hardware, or stored in a memory in a computer device in the form of software, so that the processor can call and execute the operations corresponding to the above-mentioned modules.

[0128] In an exemplary embodiment, a computer device is provided. The computer device may be a server, and its internal structural diagram may be as shown in Figure 6 the following figure. The computer device includes a processor, a memory, an input / output interface (Input / Output, abbreviated as I / O), a communication interface, a display unit, and an input device. Among them, the processor, the memory, and the input / output interface are connected through a system bus, and the communication interface, the display unit, and the input device are connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store resource data. The input / output interface of the computer device is used to exchange information between the processor and external devices. The communication interface of the computer device is used to communicate with external terminals through a network connection. When the computer program is executed by the processor, it implements an application resource caching method.

[0129] The display unit of the computer device is used to form a visually visible picture, and it can be a display screen, a projection device, or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen. The input device of the computer device can be a touch layer covered on the display screen, or a button, a trackball, or a touchpad set on the computer device housing, or an external keyboard, touchpad, or mouse, etc.

[0130] Those skilled in the art can understand that Figure 6 the structure shown in the figure is only a block diagram of some structures related to the solution of this application, and does not constitute a limitation on the computer device to which the solution of this application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine some components, or have different component arrangements.

[0131] In an exemplary embodiment, a computer device is provided, including a memory and a processor. A computer program is stored in the memory, and when the processor executes the computer program, it implements the steps in the above method embodiments.

[0132] In an embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by the processor, it implements the steps in the above method embodiments.

[0133] In an embodiment, a computer program product is provided, including a computer program. When the computer program is executed by the processor, it implements the steps in the above method embodiments.

[0134] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the users or fully authorized by all parties, and the collection, use, and processing of relevant data need to comply with relevant regulations.

[0135] Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above methods. Among them, any reference to a memory, database, or other medium used in the embodiments provided in this application can include at least one of non-volatile memory 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), magnetoresistive 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 be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc. The databases involved in the embodiments provided in this application can include at least one of relational databases and non-relational databases. Non-relational databases can include distributed databases based on blockchain, etc., without limitation. The processors involved in the embodiments provided in this application can be general-purpose processors, central processors, graphics processors, digital signal processors, programmable logic devices, data processing logics based on quantum computing, artificial intelligence (AI) processors, etc., without limitation.

[0136] The technical features of the above embodiments can be combined arbitrarily. For the sake of brevity of description, 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, it should be considered as the scope recorded in this application.

[0137] The above-described embodiments merely represent several implementation manners of this application. The description is relatively specific and detailed, but it should not be construed as a limitation on the scope of the patent of this application. It should be noted that for those of ordinary skill in the art, without departing from the concept of this application, several modifications and improvements can still be made, and these all belong to the protection scope of this application. Therefore, the protection scope of this application should be subject to the appended claims.

Claims

1. An application resource caching method, characterized in that, Applied to a target client, the method includes: Generating a usage request for a web application and determining a resource list corresponding to the usage request; Sending the usage request to a server and intercepting the resources returned by the server according to the resource list; In the case that the target resources corresponding to the resource list do not exist in the local cache or there are target resources to be updated, intercepting the target resources from the resources according to a preset resource strategy and storing them under a preset resource category in the local cache; the preset resource category includes api category, css category, JavaScript category, and html category; Running the web application based on the target resources and the resources corresponding to the resource list that already exist in the local cache.

2. The method according to claim 1, wherein The method further includes: Obtaining the request header of each resource corresponding to the resource list and the modification information of each resource included in the request header; the modification information includes the modification times and modification time points of the resources; Determining the modification frequency of each resource based on the modification information; Sorting the resources corresponding to the resource list from smallest to largest based on the modification frequency to obtain a first-order list, and storing the resources locally in sequence according to the first-order list.

3. The method according to claim 1, wherein The intercepting the target resources from the resources according to a preset resource strategy includes: For the target resources of the api category and html category, intercepting from the resources each time; For the target resources of the css category and JavaScript category, intercepting from the resources in the case that the target resources corresponding to the resource list do not exist in the local cache.

4. The method according to claim 1, characterized in that The method further includes: In the case that all the resources corresponding to the resource list exist in the local cache and there are no resources to be updated, running the web application based on all the resources corresponding to the resource list that exist in the local cache.

5. A method for caching application resources, characterized in that, Applied to a server, the method includes: Receiving a usage request sent by a target client and determining a resource list corresponding to the usage request; Sending the resource list to a development client, receiving the resources packaged by the development client according to a preset naming rule, intercepting the corresponding resources from the resources according to a preset strategy, and storing them under a preset resource category in the local cache; Sending the resources to the target client; the preset naming rule is to calculate the hash value of each resource and name each resource according to the hash value; the preset resource category includes html category, css category, JavaScript category, picture and video category, and cache script category.

6. The method according to claim 5, wherein The intercepting the corresponding resources from the resources according to a preset strategy includes: For the resources of the cache script category and html category, intercepting from the corresponding resources each time; For the resources of the css category, JavaScript category, and picture and video category, intercepting from the corresponding resources in the case that they do not exist in the local cache.

7. The method according to claim 5, wherein The storing them under a preset resource category in the local cache includes: For the resources of the html category and cache script category, prohibiting storage in the local cache; For resources such as CSS classes, JavaScript classes, and image and video classes, set corresponding storage durations according to preset storage rules.

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

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

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