A resource processing method, apparatus, device, storage medium, and program product
By preprocessing the data packets of offline resource files on the server to generate index cache and entity cache structures, the user terminal can directly load the target resource file information, which solves the problems of low resource loading efficiency and high memory consumption in the existing technology and achieves efficient resource loading and rendering.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- TENCENT TECHNOLOGY (SHENZHEN) CO LTD
- Filing Date
- 2024-12-12
- Publication Date
- 2026-06-12
AI Technical Summary
Existing technologies rely on the WebView's shouldInterceptRequest method when loading web page resource files, resulting in multiple local lookups and reads of resource files, which is inefficient and incurs time and space overhead for resource conversion and memory mapping.
The server pre-divides the data packets of offline resource files into file structures, generating an index cache structure and an entity cache structure, including a second index value and a file identifier. The user terminal directly loads the target resource file information through the index value and cache structure, avoiding multiple resource file format conversions.
It improves resource loading and reading efficiency, reduces the overhead of memory mapping and resource conversion, and increases webpage rendering speed.
Smart Images

Figure CN122196287A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, specifically to a method, apparatus, device, storage medium, and program product for resource processing. Background Technology
[0002] Loading resource files from the data package is a crucial step in webpage rendering. During webpage rendering, the resource files that need to be loaded mainly include Hypertext Markup Language (HTML), Cascading Style Sheets (CSS), JavaScript, images, videos, audio, and fonts. Rendering webpages using resource files can enrich the visual experience and improve loading speed and performance.
[0003] In solutions that render web pages by loading resource files, the common approach is to monitor the `shouldInterceptRequest` method of `WebViewClient` and identify the resource file using a Uniform Resource Locator (URL). The URL is then used to match local resources. If a match is found, the resource file is read and returned to the kernel, eliminating the need for the kernel to execute network request logic to obtain the resource file. However, this current solution relies on the `shouldInterceptRequest` method provided by `WebView`. Intercepting and loading local offline resource files using `shouldInterceptRequest` requires multiple searches for and reading of the resource file locally, resulting in low efficiency. Furthermore, since the current solution reads resource files through a Java interface, the kernel still needs to perform a resource file format conversion before actually loading the resource, incurring time and space overhead for resource conversion and memory mapping. Summary of the Invention
[0004] This application provides a method, apparatus, device, storage medium, and program product for resource processing, which improves the efficiency of resource loading and reading, and reduces the overhead of memory mapping and resource conversion.
[0005] In view of this, the first aspect of this application provides a method for resource processing. This method can be applied to a user terminal. The resource processing method includes:
[0006] Obtain the resource loading request, which includes a first index value and the page to be processed. The first index value is used to identify the resource files required to render the page to be processed.
[0007] The server receives an index cache structure and an entity cache structure. The index cache structure includes a second index value and metadata corresponding to the second index value. The entity cache structure includes a first identifier, which is obtained from the second index value and a file identifier. The file identifier is used to identify the file information of the offline resource file stored in the target cache. The metadata is used to characterize the file header information of the offline resource file. The index cache structure and the entity cache structure are obtained by the server dividing the data packets of the offline resource file into file structures.
[0008] Load the target metadata from the index cache structure based on the first and second index values;
[0009] Based on the first index value, the second index value, and the first identifier in the entity cache structure, load the target offline resource file information;
[0010] The page to be processed is rendered based on the target metadata and target offline resource file information to obtain the target page.
[0011] A second aspect of this application provides a method for resource processing. This method can be applied to a server. The resource processing method includes:
[0012] Retrieve the data package of the offline resource file. The data package of the offline resource file includes the resource path and file information of the offline resource file.
[0013] The index cache structure is determined based on the resource path. The index cache structure includes the second index value and the metadata corresponding to the second index value. The second index value is used to identify the resource path of the offline resource file.
[0014] An entity cache structure is generated based on the file information and second index value of the offline resource file. The entity cache structure includes a first identifier, which is obtained from the second index value and the file identifier. The file identifier is used to identify the file information of the offline resource file.
[0015] The index cache structure and entity cache structure are sent to the user terminal. The index cache structure and entity cache structure are used by the user terminal to load the target metadata and target offline resource file information, and render the page to be processed based on the target metadata and target offline resource file information to obtain the target page.
[0016] A third aspect of this application provides a user terminal. The user terminal includes an acquisition unit, a processing unit, and a rendering unit. The acquisition unit is used to acquire a resource loading request, which includes a first index value and a page to be processed. The first index value is used to identify the resource files required to render the page to be processed.
[0017] The acquisition unit is used to receive the index cache structure and entity cache structure sent by the server. The index cache structure includes a second index value and metadata corresponding to the second index value. The entity cache structure includes a first identifier, which is obtained from the second index value and the file identifier. The file identifier is used to identify the file information of the offline resource file stored in the target cache. The metadata is used to characterize the file header information of the offline resource file. The index cache structure and entity cache structure are obtained by the server dividing the data packet of the offline resource file into file structures.
[0018] A processing unit is used to load target metadata from an index cache structure based on a first index value and a second index value;
[0019] The processing unit is used to load the target offline resource file information based on the first index value, the second index value, and the first identifier in the entity cache structure;
[0020] The rendering unit is used to render the page to be processed based on the target metadata and target offline resource file information to obtain the target page.
[0021] In one possible design, in one implementation of the third aspect of the embodiments of this application, the processing unit is specifically used for:
[0022] When the first index value matches any second index value, read the metadata corresponding to the matched second index value to load the target metadata.
[0023] In one possible design, in another implementation of the third aspect of the embodiments of this application, the processing unit is specifically used for:
[0024] When the first index value is matched with the third index value, the second identifier is determined from the entity cache structure based on the third index value. The second index value in the second identifier is the same as the third index value. The second identifier is any one of the first identifiers, and the third index value is any second index value in the index cache structure.
[0025] Based on the file identifier in the second identifier, the file information of the corresponding offline resource file is read from the target cache to load the target offline resource file information.
[0026] In one possible design, in another implementation of the third aspect of the embodiments of this application, the target cache includes an online resource cache; the processing unit is specifically used for:
[0027] When the second index value includes the network request index value, the file information of the corresponding offline resource file is read from the online resource cache based on the file identifier in the second identifier, so as to load the target offline resource file information.
[0028] In one possible design, in another implementation of the third aspect of the embodiments of this application, the target cache includes an offline resource cache; the processing unit is specifically used for:
[0029] When the second index value includes the offline request index value, the file information of the corresponding offline resource file is read from the offline resource cache based on the file identifier in the second identifier, so as to load the target offline resource file information.
[0030] In one possible design, in another implementation of the third aspect of the embodiments of this application, the processing unit is further configured to:
[0031] The page to be processed is rendered based on the target metadata and the file information of the target offline resource file. Before the target page is obtained, the target metadata and the file information of the target offline resource file are written into the request return cache.
[0032] Read the target metadata and file information of the target offline resource file from the request response cache;
[0033] The rendering unit is specifically used to render the page to be processed based on the target metadata and file information of the target offline resource file, so as to obtain the target page.
[0034] A fourth aspect of this application provides a server. The server includes an acquisition module, a processing module, and a sending module. The acquisition module is used to acquire data packets of offline resource files, the data packets of which include the resource path and file information of the offline resource files.
[0035] The processing module is used to determine the index cache structure based on the resource path. The index cache structure includes the second index value and the metadata corresponding to the second index value. The second index value is used to identify the resource path of the offline resource file.
[0036] The processing module is used to generate an entity cache structure based on the file information and second index value of the offline resource file. The entity cache structure includes a first identifier, which is obtained from the second index value and the file identifier. The file identifier is used to identify the file information of the offline resource file.
[0037] The sending module is used to send the index cache structure and the entity cache structure to the user terminal. The index cache structure and the entity cache structure are used by the user terminal to load the target metadata and the target offline resource file information, and to render the page to be processed based on the target metadata and the target offline resource file information to obtain the target page.
[0038] In one possible design, in another implementation of the fourth aspect of the embodiments of this application, the processing module is specifically used for:
[0039] Iterate through the resource paths and read the path names of the resource paths;
[0040] Perform a hash calculation on the path name of the resource path to obtain the hash value of the corresponding resource path;
[0041] A second index value is generated based on the hash value of the resource path;
[0042] The request return data is generated based on the hash value of the resource path, and the request return data is used as the metadata corresponding to the second index value.
[0043] An index cache structure is generated based on the second index value and the metadata corresponding to the second index value.
[0044] In another aspect, this application provides a computer device including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the methods described above.
[0045] Another aspect of this application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the methods described above.
[0046] Another aspect of this application provides a computer program product, including a computer program that, when executed by a processor, implements the methods described above.
[0047] As can be seen from the above technical solutions, the embodiments of this application have the following advantages:
[0048] In this embodiment, the server pre-divides the data packets of offline resource files into an index cache structure and an entity cache structure, and sends them to the user terminal. The index cache structure includes a second index value and metadata corresponding to that second index value. The entity cache structure includes a first identifier, which is obtained from the second index value and a file identifier. The file identifier identifies the file information of the offline resource file stored in the target cache, and the metadata represents the file header information of the offline resource file. Furthermore, the user terminal obtains a resource loading request, which includes a first index value and a page to be processed. The first index value identifies the resource file required to render the page to be processed. Thus, after obtaining the resource loading request, the user terminal can load the target metadata from the index cache structure using the first and second index values; and it can also load the target offline resource file information using the first index value, the second index value, and the first identifier in the entity cache structure. Therefore, the user terminal then renders the page to be processed based on the target metadata and the target offline resource file information to obtain the target page.
[0049] By employing the above method, during the process of uploading offline resources, the server preprocesses the data packets of the offline resource files, transforming them into index cache and entity cache structures directly accessible to the kernel in the user terminal. This solves the problem of poor efficiency in subsequent kernel resource loading and reading, improving the efficiency of resource loading and reading. Furthermore, this application loads target metadata and target offline resource file information by matching the index values in the resource loading request with the index values in the index cache and entity cache structures. This enables direct loading of offline resource files from the target cache within the kernel, eliminating the need for multiple resource file format conversions and reducing the overhead of memory mapping and resource conversion. Attached Figure Description
[0050] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0051] Figure 1 This diagram illustrates the loading process of resource files provided by the relevant solutions.
[0052] Figure 2 A schematic diagram of the system framework for resource processing provided in this application is shown;
[0053] Figure 3 A schematic diagram of the structure of the server provided in this application is shown;
[0054] Figure 4 A schematic diagram of the structure of the user terminal provided in this application is shown;
[0055] Figure 5 A flowchart illustrating the resource processing method provided in this application is shown.
[0056] Figure 6 A schematic diagram of the data packet conversion process provided in this application is shown;
[0057] Figure 7A A schematic diagram of the send index cache structure and entity cache structure provided in this application is shown;
[0058] Figure 7B Another schematic diagram of the send index cache structure and entity cache structure provided in this application is shown;
[0059] Figure 8 Another flowchart illustrating the resource processing method provided in this application is shown;
[0060] Figure 9 Another flowchart illustrating the resource processing method provided in this application is shown;
[0061] Figure 10 A schematic diagram of an embodiment of the user terminal provided in this application is shown;
[0062] Figure 11 A schematic diagram of an embodiment of the server provided in this application is shown;
[0063] Figure 12 A schematic diagram of the hardware structure of the computer device provided in this application is shown. Detailed Implementation
[0064] This application provides a method, apparatus, device, storage medium, and program product for resource processing, which improves the efficiency of resource loading and reading, and reduces the overhead of memory mapping and resource conversion.
[0065] It is understood that in the specific embodiments of this application, data such as user information are involved. When the above embodiments of this application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions.
[0066] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0067] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a particular order or sequence. It should be understood that such data can be interchanged where appropriate so that implementations of the application described herein can be implemented, for example, in sequences other than those illustrated or described herein. Furthermore, the terms “comprising” and “having,” and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0068] During webpage rendering, resource files can be loaded to complete the rendering process. For example, for webpages in a browser client, resources such as HTML files, CSS files, JavaScript files, audio and video media resources, and font files can be loaded to render the webpage in that browser client.
[0069] In related solutions, it's common practice to rely on monitoring the `shouldInterceptRequest` method of `WebViewClient` and then loading resource files via the URL. For example, Figure 1 A schematic diagram illustrating the resource file loading process provided by the relevant solution is shown. For example... Figure 1 As shown, the user first loads a resource request via a WebView client deployed on the user's terminal. This resource loading request includes the page to be processed. The backend server then intercepts the current resource loading request using the `shouldInterceptRequest` method of `WebViewClient`. Subsequently, the backend server uses the parameter information in the `shouldInterceptRequest` method (such as resource path, resource name, etc.) to search for a matching resource file in the local offline resource path. If the resource matching the resource loading request exists in the local offline resources, the corresponding resource file is read from the local resource cache path. Using the resource file read from the local resource cache path, a network request is constructed and returned to the kernel processing module in the user's terminal. After receiving the returned network request, the kernel processing module in the user's terminal processes the network request (actually an offline network request structure disguised as an online network request) and parses the network request parameters to obtain the resource file. Thus, the kernel processing module in the user's terminal uses the resource file to perform page rendering.
[0070] from Figure 1 As shown in the flowchart, the current solution relies on the `shouldInterceptRequest` method provided by WebView. During the process of `shouldInterceptRequest` intercepting and loading local offline resource files, it needs to search for and read the resource files locally multiple times, resulting in low efficiency. Furthermore, since the current solution reads resource files through a Java interface, the kernel still needs to perform a resource conversion before actually loading the resource, incurring time and space overhead from resource conversion and memory mapping.
[0071] Therefore, to solve the aforementioned technical problems, embodiments of this application provide a resource processing method. This resource processing method can be applied to various offline resource loading scenarios. For example, offline resource loading scenarios include, but are not limited to: mobile applications loading web pages, desktop applications loading offline resources, browser caching, and web applications loading resources in offline mode, etc., and are not limited thereto in this application.
[0072] For example, the resource processing method provided in this application can be applied to Figure 2 In the system architecture shown. For example... Figure 2 As shown, the system architecture includes at least a user terminal 100 and a server 200. The user terminal 100 and the server 200 can communicate via a communication network. This communication network uses standard communication technologies and / or protocols, typically the Internet, but can also be any network, including but not limited to Bluetooth, a local area network (LAN), a metropolitan area network (MAN), a wide area network (WAN), mobile, private networks, or any combination of virtual private networks. In some embodiments, customized or dedicated data communication technologies may be used to replace or supplement the aforementioned data communication technologies.
[0073] like Figure 2 As shown, server 200 pre-divides the data packets of offline resource files into an index cache structure and an entity cache structure. It should be noted that the index cache structure includes a second index value and its corresponding metadata. The entity cache structure includes a first identifier, which is obtained from the second index value and the file identifier. Furthermore, the file identifier identifies the file information of the offline resource file stored in the target cache, and the metadata represents the file header information of the offline resource file. After obtaining the index cache structure and the entity cache structure, server 200 sends the data to user terminal 100.
[0074] like Figure 2As shown, user terminal 100 obtains a resource loading request, which includes a first index value and a page to be processed. It should be noted that the first index value is used to identify the resource file required to render the page to be processed. Thus, after obtaining the resource loading request, user terminal 100 loads the target metadata based on the first index value and the index cache structure sent by server 200. For example, it loads the target metadata from the index cache structure based on the first index value and the second index value. Similarly, user terminal 100 also needs to load the target offline resource file information based on the first index value, the index cache structure, and the entity cache structure. For example, it loads the target offline resource file information based on the first index value, the second index value in the index cache structure, and the first identifier in the entity cache structure sent by server 200. Finally, user terminal 100 renders the page to be processed based on the target metadata and the target offline resource file information to obtain the target page. Optionally, user terminal 100 can also display the target page in a visual display interface or a client such as a browser.
[0075] Optionally, in the above Figure 2 Based on the described system architecture, Figure 3 A schematic diagram of the server provided in this application is shown. Figure 3 As shown, the server 200 may include an offline package generation tool and an offline package management platform. In other words, the offline package generation tool and the offline package management platform can be deployed in the server 200 in this application.
[0076] exist Figure 3 In the illustrated structure, the offline package generation tool is primarily responsible for converting the data packets of offline resource files into a file structure that the kernel can directly load and access. Figure 2 The index caching structure and entity caching structure described herein. It should be noted that the data package of offline resource files mentioned in this application may include HTML resource files, such as resource files containing h5, js, css, and file resources.
[0077] The offline package management platform is primarily responsible for version management of offline resource file data packages. In addition, it provides business interfaces related to uploading, downloading, and updating offline resource file data packages.
[0078] Optionally, in the above Figure 2 Based on the described system architecture, Figure 4 A schematic diagram of the structure of the user terminal provided in this application is shown. Figure 4 As shown, the user terminal 100 may include an offline packet cache management module and a kernel network request proxy layer. In other words, this application allows the offline packet cache management module and the kernel network request proxy layer to be deployed in the user terminal 100.
[0079] exist Figure 4 In the illustrated structure, the offline package cache management module is mainly used to provide the business logic implementation for version management and offline package resource management of the client's local offline packages. The kernel network request proxy layer is part of the kernel in the user terminal 100, and it mainly provides the proxy implementation for kernel network requests. In this application, the network request proxy implementation is made compatible with the original online resource network access logic, while adding the business logic implementation for offline resource identification and offline resource loading. At the same time, it adapts to the loading of offline resources and modifies the kernel cache cleanup logic.
[0080] The user terminal 100 involved in this application includes, but is not limited to, mobile phones, tablets, laptops, desktop computers, smart voice interaction devices, smart home appliances, vehicle terminals, and aircraft. The client is deployed on the user terminal 100 and can run on the user terminal 100 via a browser or as a standalone application (APP).
[0081] The server 200 involved in this application can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence (AI) platforms.
[0082] Based on the above introduction, the resource processing method in this application will be described below. Figure 5 A flowchart illustrating the resource processing method provided in this application is shown. Figure 5 As shown, the resource processing method in this application embodiment can be completed by the user terminal and the server working together. The method of this application includes:
[0083] 501. The server retrieves the data packet of the offline resource file stored in the target cache. The data packet of the offline resource file includes the resource path and file information of the offline resource file.
[0084] In one or more embodiments, the data packet for the offline resource file may be stored in a target cache. This target cache may be an online resource cache or an offline resource cache. Illustratively, in the case of access via a network request, the offline resource file can be loaded from the online resource cache. In the case of access via an offline request, the offline resource file can be loaded from the offline resource cache.
[0085] To facilitate subsequent loading of offline resource files directly from the cache by user terminals, the object can upload the offline resource file's data packet to the server, allowing the server to retrieve the data packet first. This data packet includes the resource path and file information of the offline resource file.
[0086] After receiving the data packet, the server can use the resource paths and file information of the offline resource files within the packet to perform file structure conversion on the offline resource files, thereby generating a specific file structure that the kernel can directly recognize. For example, the server can call... Figure 3 The offline package generation tool described herein completes the resource conversion for this data package.
[0087] It should be noted that the number of offline resource files in the data package of offline resource files mentioned in this application may include one or more, and this application does not limit this. Furthermore, the data package of offline resource files mentioned in this application may include, but is not limited to, data packages with HTML structures, etc., and this application does not limit this.
[0088] 502. The server determines the index cache structure based on the resource path. The index cache structure includes the second index value and the metadata corresponding to the second index value. The second index value is used to identify the resource path of the offline resource file.
[0089] In one or more embodiments, after obtaining the data packet of the offline resource file, the server parses the data packet to obtain the resource path and file information of the offline resource file. Based on this resource path, the server can determine the index cache structure. It should be noted that this index cache structure can be understood as an index structure that the kernel in the user terminal can directly recognize, avoiding multiple subsequent resource conversion operations.
[0090] In some alternative embodiments, the server's method of determining the index cache structure using resource paths can be referred to... Figure 6 Please refer to the schematic diagram of the conversion process shown for understanding. For example... Figure 6 As shown, the server traverses the resource path and reads the path name of the resource path. For example, the path name of the resource path is 'www.qq.com / page / live / index.html'.
[0091] After reading the path name of a resource, the server performs a hash calculation on that path name to obtain its hash value. For example, it converts the path name 'www.qq.com / page / live / index.html' into its corresponding hash value.
[0092] Therefore, after calculating the hash value of the resource path, the server generates a second index value based on this hash value. For example, the hash value can be directly used as the second index value. It should be noted that the resource path of the offline resource file can be located through this second index value.
[0093] In addition, after calculating the hash value of the resource path, the server also needs to generate request return data and use this data as the metadata corresponding to the second index value. For example, after converting the path name 'www.qq.com / page / live / index.html' into its corresponding hash value, a request return data structure is constructed based on this hash value, such as a network request return data structure or an offline request return data structure. It should be noted that this request return data includes, but is not limited to, HTTP response headers, request methods, status codes, etc. After constructing this request return data, it is used as the metadata (meta data) corresponding to the second index value.
[0094] In other words, the index cache structure obtained by this application includes a second index value and the metadata corresponding to the second index value.
[0095] In some alternative embodiments, the second index value described in this application embodiment may include a network request index value. That is, by constructing a network request index, the kernel can access offline resource files in the online resource cache through network requests. For example, assuming the data packet includes four resource paths, namely resource path 1 to resource path 4, the corresponding index cache structure can be understood with reference to the content described in Table 1 below. Specifically:
[0096] Table 1: Index Cache Structure
[0097] Key_1 meta_1 Key_2 meta_2 Key_3 meta_3 Key_4 meta_4 ..... .....
[0098] As shown in Table 1 above, for resource path 1, its second index value can be represented by Key_1, and its corresponding metadata is meta_1. Similarly, for resource path 2, its second index value can be represented by Key_2, and its corresponding metadata is meta_2. For resource path 3, its second index value can be represented by Key_3, and its corresponding metadata is meta_3. For resource path 4, its second index value can be represented by Key_4, and its corresponding metadata is meta_4.
[0099] Optionally, this application can also extend the kernel's native cache data structure to enable loading offline resource files via HTTP cache within the kernel. In other words, the second index value described in the embodiments of this application can include an offline request index value. That is, by constructing an independent offline cache index, the kernel's cache data is modified to facilitate prioritizing the use of the offline resource cache to load offline resource files.
[0100] For example, suppose a data packet includes four resource paths, namely resource path 1 to resource path 4. The corresponding index cache structure can be understood by referring to the description in Table 2 below. Specifically:
[0101] Table 2: Index Cache Structure
[0102] off_Key_1 meta_1 off_Key_2 meta_2 off_Key_3 meta_3 off_Key_4 meta_4 ..... .....
[0103] As shown in Table 2 above, for resource path 1, its second index value can be represented by off_Key_1, and its corresponding metadata is meta_1. Similarly, for resource path 2, its second index value can be represented by off_Key_2, and its corresponding metadata is meta_2. For resource path 3, its second index value can be represented by off_Key_3, and its corresponding metadata is meta_3. For resource path 4, its second index value can be represented by off_Key_4, and its corresponding metadata is meta_4.
[0104] It should be noted that, regarding the difference between Table 1 and Table 2 above, the second index values in Table 1, such as Key_1, Key_2, Key_3, Key_4, etc., can be understood as the network request index values described above; the second index values in Table 2, such as off_Key_1, off_Key_2, off_Key_3, off_Key_4, etc., can be understood as the offline request index values described above.
[0105] 503. The server generates an entity cache structure based on the file information and second index value of the offline resource file. The entity cache structure includes a first identifier, which is obtained from the second index value and the file identifier. The file identifier is used to identify the file information of the offline resource file.
[0106] In one or more embodiments, after the server executes step 501 to obtain the file information of the offline resource file and step 502 to determine the second index value, it can also generate an entity cache structure based on the file information of the offline resource file and the second index value. This entity cache structure includes a first identifier. Furthermore, the first identifier is obtained from the second index value and the file identifier. The file identifier can be used to identify the file information of the offline resource file. That is, through the first identifier, the second index value in the index cache structure can be associated with the file information of the offline resource file.
[0107] In some alternative examples, the process by which the server generates the entity cache structure using the file information and second index value of the offline resource file can be understood in the following way:
[0108] The server can read the file information of the offline resource file corresponding to the resource path into the file body, and generate a first identifier based on the file identifier and the second index value, as detailed above. Figure 6 The content described is understood. The first identifier indicates the corresponding file body. That is, the first identifier reflects the name of the file body, i.e., hashKey + file identifier.
[0109] For example, suppose a data packet includes four resource paths, namely resource path 1 to resource path 4. Based on the index cache structure described in Table 1 above, the corresponding entity cache structure can be understood by referring to the content described in Table 3 below. Specifically:
[0110] Table 3: Entity Cache Structure
[0111] Key_1+file_index Key_1+file_index_2 Key_2+file_index Key_3+file_index .....
[0112] As shown in Table 2 above, the entity cache structure includes four first identifiers: Key_1+file_index, Key_1+file_index_2, Key_2+file_index, and Key_3+file_index. Key_1+file_index includes the second index value Key_1 and the file identifier file_index, which can be used to indicate a segment of file information from an offline resource file in resource path 1 of the online resource cache. Key_1+file_index_2 includes the second index value Key_1 and the file identifier file_index_2, which can be used to indicate another segment of file information from an offline resource file in resource path 1 of the online resource cache. It should be noted that the file identifier file_index_2 and the file identifier file_index can be used to represent file information from different segments of the same offline resource file.
[0113] Additionally, Key_2+file_index includes a second index value Key_2 and a file identifier file_index, which can be used to indicate file information from offline resource files in resource path 2 of the online resource cache. Similarly, Key_3+file_index includes a second index value Key_3 and a file identifier file_index, which can be used to indicate file information from offline resource files in resource path 3 of the online resource cache.
[0114] Alternatively, for example, suppose the data packet includes four resource paths, namely resource path 1 to resource path 4. Based on the index cache structure described in Table 2 above, the corresponding entity cache structure can be understood with reference to the content described in Table 4 below. Specifically:
[0115] Table 4: Entity Cache Structure
[0116] off_Key_1+file_index off_Key_1+file_index_2 off_Key_2+file_index off_Key_3+file_index .....
[0117] As shown in Table 4 above, this entity cache structure includes four first identifiers: off_Key_1+file_index, off_Key_1+file_index_2, off_Key_2+file_index, and off_Key_3+file_index. Off_Key_1+file_index includes the second index value off_Key_1 and the file identifier file_index, which can be used to indicate a segment of file information from an offline resource file in resource path 1 of the offline resource cache. Off_Key_1+file_index_2 includes the second index value off_Key_1 and the file identifier file_index_2, which can be used to indicate another segment of file information from an offline resource file in resource path 1 of the offline resource cache. It should be noted that the file identifier file_index_2 and the file identifier file_index can be used to represent file information from different segments of the same offline resource file.
[0118] Additionally, for `off_Key_2+file_index`, which includes a second index value `off_Key_2` and a file identifier `file_index`, it can be used to indicate file information from offline resource files in resource path 2 of the offline resource cache. Similarly, for `off_Key_3+file_index`, which includes a second index value `off_Key_3` and a file identifier `file_index`, it can be used to indicate file information from offline resource files in resource path 3 of the offline resource cache.
[0119] 504. The server sends the index cache structure and entity cache structure to the user terminal.
[0120] In one or more embodiments, after generating the index cache structure and the entity cache structure, the server also needs to send the index cache structure and the entity cache structure to the user terminal so that the user terminal can obtain the corresponding target resource and other information based on the index cache structure and the entity cache structure after obtaining the resource loading request, which facilitates the rendering of the page.
[0121] For example, Figure 7A A schematic diagram of the send index cache structure and entity cache structure provided in this application is shown. Figure 7A As shown, the server can send the index cache structure described in Table 1 and the entity cache structure described in Table 3 to the user terminal. Similarly, Figure 7B Another schematic diagram of the send index cache structure and entity cache structure provided in this application is shown. For example... Figure 7BAs shown, the server can send the index cache structure described in Table 2 and the entity cache structure described in Table 4 to the user terminal.
[0122] In some alternative embodiments, the server may also compress the index cache structure and entity cache structure after generating them, and then send the compressed index cache structure and entity cache structure to the user terminal to improve information transmission efficiency.
[0123] 505. The user terminal obtains a resource loading request. The resource loading request includes a first index value and a page to be processed. The first index value is used to identify the resource files required to render the page to be processed.
[0124] In one or more embodiments, when an object needs a webpage, it can upload the required page to the user terminal. Thus, the user terminal can also obtain a resource loading request upon receiving the page to be processed.
[0125] It should be noted that this resource loading request includes a first index value and a page to be processed. The first index value indicates and identifies the resource files required to render the page to be processed. The page to be processed can be understood as the page to be rendered. For example, the page to be processed includes, but is not limited to, HTTP pages.
[0126] 506. The user terminal loads the target metadata from the index cache structure based on the first index value and the second index value.
[0127] In one or more embodiments, after generating the index cache structure and the entity cache structure, the server sends the index cache structure and the entity cache structure to the user terminal. Thus, the user terminal can receive the index cache structure and the entity cache structure sent by the server. It should be noted that the index cache structure and the entity cache structure described here can be understood with reference to the content described in steps 502 and 503 above, and will not be repeated here. In this way, after receiving a resource loading request, the user terminal can load the target metadata from the index cache structure based on the first index value and the second index value.
[0128] As an illustrative example, the user terminal can match a first index value with each second index value in the index cache structure. If the first index value matches any second index value, the user terminal determines the metadata corresponding to the matched second index value as the target metadata. The user terminal then loads this target metadata.
[0129] For example, as mentioned above Figure 7ATaking the illustrated index cache structure and entity cache structure as examples, assume the first index value is Key_1. The user terminal then matches Key_1 with Key_1, Key_2, Key_3, and Key_4 in the index cache structure. The matching process shows that the matched second index value is Key_1. Thus, the user terminal can load the metadata (i.e., meta_1) corresponding to Key_1.
[0130] 507. The user terminal loads the target offline resource file information based on the first index value, the second index value, and the first identifier in the entity cache structure.
[0131] In one or more embodiments, after generating the index cache structure and the entity cache structure, the server sends the index cache structure and the entity cache structure to the user terminal. Thus, the user terminal can receive the index cache structure and the entity cache structure sent by the server. It should be noted that the index cache structure and the entity cache structure described here can be understood with reference to the content described in steps 502 and 503 above, and will not be repeated here. In this way, after obtaining the index cache structure and the entity cache structure, the user terminal can load the target offline resource file information based on the first index value, the second index value in the index cache structure, and the first identifier in the entity cache structure.
[0132] As an illustrative description, the user terminal can match the first index value with each second index value in the index cache structure. If the first index value matches the third index value, the user terminal determines the second identifier from the entity cache structure based on the third index value. Then, based on the file identifier in the second identifier, the user terminal reads the file information of the corresponding offline resource file from the target cache to load the target offline resource file information. It should be noted that the second index value in the second identifier is the same as the third index value. Furthermore, the second identifier can be any one of the first identifiers, and the third index value can be any second index value in the index cache structure.
[0133] In some alternative embodiments, the target cache includes an online resource cache. The user terminal can load the target offline resource file information in step 507 by: when the second index value includes a network request index value, the user terminal reads the file information of the corresponding offline resource file from the online resource cache based on the file identifier in the second identifier, in order to load the target offline resource file information.
[0134] For example, taking the index cache structure shown in Table 1 and the entity cache structure shown in Table 3 as examples, assume the first index value is Key_1. The user terminal then matches Key_1 with Key_1, Key_2, Key_3, and Key_4 in the index cache structure. The matching shows that the matched second index value is Key_1. The user terminal can then match Key_1 with each first identifier in the entity cache structure. The matching shows that the matched first identifiers (i.e., the aforementioned second identifiers) are Key_1 + file_index and Key_1 + file_index_2. Based on the file identifiers in these two second identifiers, namely file_index and file_index_2, the user terminal reads the file information of the corresponding offline resource file from the online resource cache. Thus, the target offline resource file information is determined based on the file information read from file_index and the file information read from file_index_2. The user terminal then loads the target offline resource file information.
[0135] In some alternative embodiments, the target cache includes an offline resource cache. The user terminal can also load the target offline resource file information in step 507 by: when the second index value includes the offline request index value, the user terminal reads the file information of the corresponding offline resource file from the offline resource cache based on the file identifier in the second identifier, in order to load the target offline resource file information.
[0136] For example, taking the index cache structure shown in Table 2 and the entity cache structure shown in Table 4 as examples, assume the first index value is off_Key_2. The user terminal then matches this off_Key_2 with off_Key_1, off_Key_2, off_Key_3, and off_Key_4 in the index cache structure, respectively. The matching shows that the matched second index value is off_Key_2. The user terminal can then match this off_Key_2 with each first identifier in the entity cache structure. The matching shows that the matched first identifier (i.e., the aforementioned second identifier) is off_Key_2 + file_index. Therefore, the user terminal, based on the file identifier in this second identifier, i.e., file_index, reads the file information of the corresponding offline resource file from the offline resource cache. Thus, the target offline resource file information is determined based on the file information of the offline resource file read from file_index. The user terminal then loads the target offline resource file information.
[0137] 508. The user terminal renders the page to be processed based on the target metadata and target offline resource file information to obtain the target page.
[0138] In one or more embodiments, after loading the target metadata and target offline resource file information, the user terminal can complete the rendering process of the page to be processed based on the target metadata and target offline resource file information, thereby obtaining the target page.
[0139] As an illustrative example, after loading the target metadata and target offline resource file information, the user terminal can first write the target metadata and target offline resource file information into the request response cache. Then, the user terminal reads the target metadata and target offline resource file information from the request response cache. Finally, the user terminal renders the page to be processed based on the target metadata and target offline resource file information to obtain the target page.
[0140] In some alternative embodiments, after the user terminal renders the target page, it can also display the target page through a visual display interface or a client such as a browser to facilitate object viewing.
[0141] In some other alternative embodiments, Figure 8 Another flowchart illustrating the resource processing method provided in this application is shown. Figure 8 As shown, the object uploads the data package of offline resource files to the server. The server then uses, for example... Figure 3 The offline package generation tool described above performs resource conversion on the data package of the offline resource file to obtain the entity cache structure and index cache structure. For details, please refer to the aforementioned... Figure 5 The contents of steps 502 and 503 will be understood and will not be elaborated here.
[0142] Additionally, the object can trigger the loading logic of the webpage to be processed through the user terminal. Thus, the user terminal constructs a default network request implementation through the kernel's external interface layer (such as WebView), and then passes the resource loading request to the kernel of the client in the user terminal for processing.
[0143] Subsequently, the network request module in the kernel of the user terminal processes the parameters of the resource loading request using the default method parameters, and forwards the current resource loading request to, for example, Figure 4 The kernel network request proxy layer in the system reads the first index value to be loaded from the default resource load request implementation.
[0144] Furthermore, the kernel network request proxy layer uses this first index value to match whether a corresponding local resource index (i.e., the second index value) exists in the index cache structure. If a local resource index exists, it is used to access the file information of the corresponding offline resource file from the kernel cache and return the file information of the offline resource file to the kernel rendering module. If no local resource index exists, the default kernel network request is used to load the online resource file.
[0145] In this way, the kernel rendering module directly uses the file information and header information of the aforementioned offline resource files to render the page to be processed, thereby obtaining the target page.
[0146] In another alternative embodiment, Figure 9 Another flowchart illustrating the resource processing method provided in this application is shown. Figure 9 As shown, the user terminal calls the WebView-related interfaces, and the kernel identifies the interface calls to obtain the parameters of the resource loading request. It should be noted that these parameters may undergo initial kernel processing such as encoding and coding.
[0147] Furthermore, the user terminal obtains the first index value from the parameters of the resource loading request through the kernel network request proxy layer. Using this first index value, it searches the index cache structure for a matching second index value. If a matching second index value is found, the corresponding index information is read, and the meta data within the index information is parsed as the network request header return value. The first index value is also used to search the entity cache structure for the file information of the corresponding offline resource file.
[0148] Then, the file information of the loaded metadata and offline resource files is written to the network request response cache. The user terminal then reads the metadata and offline resource file information from the network request response cache through the kernel and performs resource rendering on the page to be processed.
[0149] In this embodiment, the data packets of offline resource files are pre-processed in the server to convert them into data structures (i.e., index cache structure and entity cache structure) that the kernel can directly load and render. Therefore, when the user terminal processes kernel network requests (such as resource loading requests) through the kernel network request proxy layer, it prioritizes reading file information and metadata of offline resource files from the target cache via the index, reducing the time consumption of kernel API and kernel data transmission and conversion, and greatly improving the loading efficiency of offline resources.
[0150] The foregoing primarily describes the solutions provided by the embodiments of this application from a methodological perspective. It is understood that to achieve the above functions, corresponding hardware structures and / or software modules are included to execute each function. Those skilled in the art should readily recognize that, based on the modules and algorithm steps described in conjunction with the embodiments disclosed in this application, this application can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed in hardware or by computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0151] The user terminal in this application is described in detail below. Please refer to [link / reference]. Figure 10 , Figure 10 A schematic diagram of an embodiment of the user terminal provided in this application is shown. Figure 10 As shown, the user terminal includes:
[0152] The acquisition unit 1001 is used to acquire a resource loading request. The resource loading request includes a first index value and a page to be processed. The first index value is used to identify the resource file required to render the page to be processed.
[0153] The acquisition unit 1001 is used to receive the index cache structure and entity cache structure sent by the server. The index cache structure includes a second index value and metadata corresponding to the second index value. The entity cache structure includes a first identifier, which is obtained by the second index value and a file identifier. The file identifier is used to identify the file information of the offline resource file stored in the target cache. The metadata is used to characterize the file header information of the offline resource file. The index cache structure and entity cache structure are obtained by the server dividing the data packet of the offline resource file into file structures.
[0154] Processing unit 1002 is used to load target metadata from an index cache structure based on a first index value and a second index value;
[0155] Processing unit 1002 is used to load target offline resource file information based on the first index value, the second index value, and the first identifier in the entity cache structure;
[0156] Rendering unit 1003 is used to render the page to be processed based on the target metadata and target offline resource file information to obtain the target page.
[0157] Optionally, in the above Figure 10 Based on the corresponding embodiments, in another embodiment of the user terminal provided in this application, the processing unit 1002 is specifically used for:
[0158] When the first index value matches any second index value, read the metadata corresponding to the matched second index value to load the target metadata.
[0159] Optionally, in the above Figure 10 Based on the corresponding embodiments, in another embodiment of the user terminal provided in this application, the processing unit 1002 is specifically used for:
[0160] When the first index value is matched with the third index value, the second identifier is determined from the entity cache structure based on the third index value. The second index value in the second identifier is the same as the third index value. The second identifier is any one of the first identifiers, and the third index value is any second index value in the index cache structure.
[0161] Based on the file identifier in the second identifier, the file information of the corresponding offline resource file is read from the target cache to load the target offline resource file information.
[0162] Optionally, in the above Figure 10 Based on the corresponding embodiments, in another embodiment of the user terminal provided in this application, the target cache includes an online resource cache;
[0163] The processing unit 1002 is specifically used to: when the second index value includes the network request index value, read the file information of the corresponding offline resource file from the online resource cache based on the file identifier in the second identifier, so as to load the target offline resource file information.
[0164] Optionally, in the above Figure 10 Based on the corresponding embodiments, in another embodiment of the user terminal provided in this application, the target cache includes an offline resource cache;
[0165] The processing unit 1002 is specifically used to: when the second index value includes the offline request index value, read the file information of the corresponding offline resource file from the offline resource cache based on the file identifier in the second identifier, so as to load the target offline resource file information.
[0166] Optionally, in the above Figure 10 Based on the corresponding embodiments, in another embodiment of the user terminal provided in this application, the processing unit is specifically further used for:
[0167] The page to be processed is rendered based on the target metadata and the file information of the target offline resource file. Before the target page is obtained, the target metadata and the file information of the target offline resource file are written into the request return cache.
[0168] Read the target metadata and file information of the target offline resource file from the request response cache;
[0169] Rendering unit 1003 is specifically used to render the page to be processed based on the target metadata and file information of the target offline resource file, so as to obtain the target page.
[0170] The server in this application is described in detail below. Please refer to [link / reference]. Figure 11 , Figure 11 A schematic diagram of an embodiment of the server provided in this application is shown. For example... Figure 11 As shown, the server includes:
[0171] The acquisition module 1101 is used to acquire the data packet of the offline resource file. The data packet of the offline resource file includes the resource path of the offline resource file and the file information of the offline resource file.
[0172] Processing module 1102 is used to determine the index cache structure based on the resource path. The index cache structure includes a second index value and metadata corresponding to the second index value. The second index value is used to identify the resource path of the offline resource file.
[0173] Processing module 1102 is used to generate an entity cache structure based on the file information and second index value of the offline resource file. The entity cache structure includes a first identifier, which is obtained from the second index value and the file identifier. The file identifier is used to identify the file information of the offline resource file.
[0174] The sending module 1103 is used to send the index cache structure and the entity cache structure to the user terminal. The index cache structure and the entity cache structure are used by the user terminal to load the target metadata and the target offline resource file information, and to render the page to be processed based on the target metadata and the target offline resource file information to obtain the target page.
[0175] Optionally, in the above Figure 11 Based on the corresponding embodiments, in another embodiment of the server provided in this application, the processing module 1102 is specifically used for:
[0176] Iterate through the resource paths and read the path names of the resource paths;
[0177] Perform a hash calculation on the path name of the resource path to obtain the hash value of the corresponding resource path;
[0178] A second index value is generated based on the hash value of the resource path;
[0179] The request return data is generated based on the hash value of the resource path, and the request return data is used as the metadata corresponding to the second index value.
[0180] An index cache structure is generated based on the second index value and the metadata corresponding to the second index value.
[0181] The user terminal and server in this application embodiment have been described above from the perspective of modular functional entities. The computer equipment in this application embodiment has been described below from the perspective of hardware processing.
[0182] Figure 12 This is a schematic diagram of the hardware structure of a computer device provided in an embodiment of this application. This computer device can vary considerably due to differences in configuration or performance, and may include, but is not limited to, the aforementioned... Figure 10 The user terminal described Figure 11 The described server, etc. For example... Figure 12 As shown, the computer device may include one or more central processing units (CPUs) 1222 (e.g., one or more processors) and a memory 1232, and one or more storage media 1230 (e.g., one or more mass storage devices) for storing application programs 1242 or data 1244. The memory 1232 and storage media 1230 may be temporary or persistent storage. The program stored in the storage media 1230 may include one or more modules (not shown in the figure), each module including a series of instruction operations on the computer device. Furthermore, the CPU 1222 may be configured to communicate with the storage media 1230 and execute the series of instruction operations in the storage media 1230 on the computer device. Exemplarily, the CPU 1222 is used to execute the application program 1242 stored in the storage media 1230, thereby implementing the resource processing method provided in the above embodiments of this application.
[0183] The computer device may also include one or more power supplies 1226, one or more wired or wireless network interfaces 1250, one or more input / output interfaces 1258, and / or one or more operating systems 1241, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, etc.
[0184] For example, Figure 12 The central processing unit 1222 can call computer execution instructions stored in memory 1232 to cause the computer device to perform actions such as... Figures 5 to 9 The method in the corresponding method embodiment.
[0185] Specifically, Figure 10 The processing unit 1002 and rendering unit 1003 in the middle Figure 11 The function / implementation process of the processing module 1102 can be achieved through... Figure 12 The central processing unit 1222 in the memory calls the computer execution instructions stored in the memory 1232 to achieve this. Figure 10 The acquisition unit 1001 in Figure 11 The functions / implementation process of the acquisition module 1101 and the transmission module 1103 can be obtained through Figure 12 It is implemented using the input / output interface 1258.
[0186] The steps performed by the computer device in the above embodiments can be based on this Figure 12 The computer device structure shown.
[0187] This application also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the steps of the methods described in the foregoing embodiments.
[0188] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the methods described in the foregoing embodiments.
[0189] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0190] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces, or indirect coupling or communication connection between apparatuses or units, and may be electrical, mechanical, or other forms.
[0191] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0192] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0193] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a server or terminal device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing computer programs, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0194] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.
Claims
1. A method for resource processing, characterized in that, Applied to a user terminal, the method includes: Obtain a resource loading request, the resource loading request including a first index value and a page to be processed, the first index value being used to identify the resource files required to render the page to be processed; The server receives an index cache structure and an entity cache structure. The index cache structure includes a second index value and metadata corresponding to the second index value. The entity cache structure includes a first identifier, which is obtained from the second index value and a file identifier. The file identifier is used to identify the file information of the offline resource file stored in the target cache. The metadata is used to characterize the file header information of the offline resource file. The index cache structure and the entity cache structure are obtained by the server dividing the data packets of the offline resource file into file structures. Load the target metadata from the index cache structure based on the first index value and the second index value; Based on the first index value, the second index value, and the first identifier in the entity cache structure, load the target offline resource file information; The page to be processed is rendered based on the target metadata and the target offline resource file information to obtain the target page.
2. The method according to claim 1, characterized in that, Based on the first index value and the second index value, the target metadata is loaded from the index cache structure, including: When the first index value matches any of the second index values, the metadata corresponding to the matched second index value is read to load the target metadata.
3. The method according to any one of claims 1 to 2, characterized in that, Based on the first index value, the second index value, and the first identifier in the entity cache structure, load the target offline resource file information, including: When the first index value is matched with the third index value, a second identifier is determined from the entity cache structure based on the third index value. The second index value in the second identifier is the same as the third index value. The second identifier is any one of the first identifiers, and the third index value is any one of the second index values in the index cache structure. Based on the file identifier in the second identifier, the file information of the corresponding offline resource file is read from the target cache to load the target offline resource file information.
4. The method according to claim 3, characterized in that, The target cache includes an online resource cache; based on the file identifier in the second identifier, the file information of the corresponding offline resource file is read from the target cache to load the target offline resource file information, including: When the second index value includes a network request index value, the file information of the corresponding offline resource file is read from the online resource cache based on the file identifier in the second identifier, so as to load the target offline resource file information.
5. The method according to claim 3, characterized in that, The target cache includes an offline resource cache; based on the file identifier in the second identifier, the file information of the corresponding offline resource file is read from the target cache to load the target offline resource file information, including: When the second index value includes the offline request index value, the file information of the corresponding offline resource file is read from the offline resource cache based on the file identifier in the second identifier, so as to load the target offline resource file information.
6. The method according to any one of claims 1 to 5, characterized in that, Before rendering the page to be processed based on the target metadata and the file information of the target offline resource file to obtain the target page, the method further includes: Write the target metadata and the file information of the target offline resource file into the request return cache; The page to be processed is rendered based on the target metadata and the file information of the target offline resource file to obtain the target page, including: Read the target metadata and file information of the target offline resource file from the request return cache; The page to be processed is rendered based on the target metadata and the file information of the target offline resource file to obtain the target page.
7. A method for resource processing, characterized in that, Applied to a server, the method includes: Obtain the data packet of the offline resource file, wherein the data packet of the offline resource file includes the resource path of the offline resource file and the file information of the offline resource file; An index cache structure is determined based on the resource path. The index cache structure includes a second index value and metadata corresponding to the second index value. The second index value is used to identify the resource path of the offline resource file. An entity cache structure is generated based on the file information of the offline resource file and the second index value. The entity cache structure includes a first identifier, which is obtained by the second index value and the file identifier. The file identifier is used to identify the file information of the offline resource file. The index cache structure and the entity cache structure are sent to the user terminal. The index cache structure and the entity cache structure are used by the user terminal to load target metadata and target offline resource file information, and to render the page to be processed based on the target metadata and the target offline resource file information to obtain the target page.
8. The method according to claim 7, characterized in that, Determining the index cache structure based on the resource path includes: Traverse the resource paths and read the path names of the resource paths; Perform a hash calculation on the path name of the resource path to obtain the hash value corresponding to the resource path; The second index value is generated based on the hash value of the resource path; Request return data is generated based on the hash value of the resource path, and the request return data is used as the metadata corresponding to the second index value; An index cache structure is generated based on the second index value and the metadata corresponding to the second index value.
9. A user terminal, characterized in that, include: The acquisition unit is used to acquire a resource loading request, the resource loading request including a first index value and a page to be processed, the first index value being used to identify the resource files required to render the page to be processed; The acquisition unit is used to receive an index cache structure and an entity cache structure sent by the server. The index cache structure includes a second index value and metadata corresponding to the second index value. The entity cache structure includes a first identifier, which is obtained by the second index value and a file identifier. The file identifier is used to identify the file information of the offline resource file stored in the target cache. The metadata is used to characterize the file header information of the offline resource file. The index cache structure and the entity cache structure are obtained by the server by dividing the data packets of the offline resource file into file structures. A processing unit is configured to load target metadata from the index cache structure based on the first index value and the second index value; The processing unit is configured to load target offline resource file information based on the first index value, the second index value, and the first identifier in the entity cache structure; The rendering unit is used to render the page to be processed based on the target metadata and the target offline resource file information to obtain the target page.
10. A server, characterized in that, include: The acquisition module is used to acquire the data packet of the offline resource file, wherein the data packet of the offline resource file includes the resource path of the offline resource file and the file information of the offline resource file; The processing module is configured to determine an index cache structure based on the resource path. The index cache structure includes a second index value and metadata corresponding to the second index value. The second index value is used to identify the resource path of the offline resource file. The processing module is used to generate an entity cache structure based on the file information of the offline resource file and the second index value. The entity cache structure includes a first identifier, which is obtained by the second index value and the file identifier. The file identifier is used to identify the file information of the offline resource file. The sending module is used to send the index cache structure and the entity cache structure to the user terminal. The index cache structure and the entity cache structure are used by the user terminal to load target metadata and target offline resource file information, and to render the page to be processed based on the target metadata and the target offline resource file information to obtain the target page.
11. 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 resource processing method according to any one of claims 1 to 8.
12. 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 resource processing method according to any one of claims 1 to 8.
13. A computer program product, comprising a computer program, characterized in that, When executed by a processor, the computer program implements the steps of the resource processing method according to any one of claims 1 to 8.