A page file generation method and apparatus
By receiving page load requests and determining simplified style data to generate target page files, the problem of increased page file generation and loading time caused by full style data is solved, thereby improving page file rendering efficiency and alleviating server pressure.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- TENCENT TECHNOLOGY (SHENZHEN) CO LTD
- Filing Date
- 2021-07-08
- Publication Date
- 2026-05-19
AI Technical Summary
The current page file generation process is hampered by redundant or invalid styles in the full style data, which increases the time required for page file generation and loading, reduces the smoothness of page interaction, and increases the pressure on the server system.
By receiving page loading requests from the terminal, the simplified style data associated with the page information is determined, thereby generating the target page file. This avoids loading delays and resource consumption caused by redundant styles, and optimizes page file generation using simplified style data.
It improved page file rendering efficiency, optimized web performance, reduced server system pressure, and enhanced user experience.
Smart Images

Figure CN115599380B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of Internet technology, and in particular to a method and apparatus for generating page files. Background Technology
[0002] Web pages serve as portals for displaying information and providing interactive operations to users. With the rapid development of communication technology and the increasing speed of data transmission, their impact on page loading speed has gradually decreased. However, the generation and rendering speed of the web page file itself has become a significant constraint on web (World Wide Web) performance and user experience. Currently, page file generation typically involves obtaining all style data based on the user's information needs and then generating the page file based on this data. However, due to version updates and the accumulation of common styles, the full style data contains many redundant or invalid styles. This not only increases the generation and loading time of the page file and reduces the smoothness of page interaction, but also increases the system pressure and resource consumption on the server, resulting in wasted performance.
[0003] Therefore, there is a need to provide a page file generation solution that can optimize web performance and alleviate server-side system pressure in order to improve user experience. Summary of the Invention
[0004] This application provides a method and apparatus for generating page files, which can effectively reduce the speed of page file generation and optimize web performance.
[0005] On the one hand, this application provides a method for generating page files, the method comprising:
[0006] The terminal receives a page loading request, which includes page information.
[0007] Determine the simplified style data associated with the page information; the simplified style data is obtained by simplifying the full style data corresponding to the type information of the matched page data.
[0008] Obtain target simplified style data that matches the type information of the target page data from the associated simplified style data;
[0009] A target page file is generated based on the target page data and the target simplified style data. The target page file is used to generate the target page corresponding to the page loading request.
[0010] On the other hand, a page file generation apparatus is provided, the apparatus comprising:
[0011] Request receiving module: used to receive page loading requests sent by the terminal, the page loading request including page information;
[0012] Page data acquisition module: used to acquire the target page data corresponding to the page information and the type information of the target page data;
[0013] The associated style data determination module is used to determine the simplified style data associated with the page information; the simplified style data is obtained by simplifying the full style data corresponding to the type information of the matched page data.
[0014] Target style data acquisition module: used to acquire target simplified style data that matches the type information of the target page data from the associated simplified style data;
[0015] Page file generation module: used to generate a target page file based on the target page data and the target simplified style data, wherein the target page file is used to generate the target page corresponding to the page loading request.
[0016] On the other hand, a page file generation device is provided, the device including a processor and a memory, the memory storing at least one instruction or at least one program segment, the at least one instruction or the at least one program segment being loaded and executed by the processor to implement the page file generation method as described above.
[0017] On the other hand, a computer-readable storage medium is provided, wherein at least one instruction or at least one program is stored therein, the at least one instruction or the at least one program being loaded and executed by a processor to implement the page file generation method as described above.
[0018] On the other hand, a server is provided, the server including a processor and a memory, the device including a processor and a memory, the memory storing at least one instruction or at least one program, the at least one instruction or the at least one program being loaded and executed by the processor to implement the page file generation method as described above.
[0019] The page file generation method, apparatus, device, storage medium, and server provided in this application have the following technical effects:
[0020] This application, upon receiving a page loading request carrying page information from a terminal, obtains the target page data and its type information corresponding to the page information; determines the simplified style data associated with the page information; retrieves the target simplified style data matching the type information of the target page data from the associated simplified style data; and generates the target page file based on the target page data and the target simplified style data. The simplified style data is obtained by simplifying the full style data corresponding to the type information of the matched page data. Thus, by pre-storing the simplified style data corresponding to the type information, the target simplified style data required to generate the target page file can be directly obtained, avoiding page loading delays and resource consumption caused by redundant styles, effectively improving page file rendering efficiency, thereby optimizing web performance and alleviating server system pressure. Attached Figure Description
[0021] To more clearly illustrate the technical solutions and advantages 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.
[0022] Figure 1 This is a schematic diagram of an application environment provided in an embodiment of this application;
[0023] Figure 2 This is a flowchart illustrating a page file generation method provided in an embodiment of this application;
[0024] Figure 3 This is a schematic diagram of the first screen of a search result provided in an embodiment of this application;
[0025] Figure 4 This is a flowchart illustrating a method for obtaining target page data and target page data type information provided in an embodiment of this application;
[0026] Figure 5 This is a flowchart illustrating a page file generation method provided in an embodiment of this application;
[0027] Figure 6 This is a flowchart illustrating a page file generation method provided in this embodiment;
[0028] Figure 7 This is a flowchart illustrating a page file generation method provided in an embodiment of this application;
[0029] Figure 8 This is a schematic diagram of the framework of a system provided in an embodiment of this application;
[0030] Figure 9 This is a flowchart illustrating a page file generation method provided in an embodiment of this application;
[0031] Figure 10 This is a schematic diagram of the structure of a page file generation device provided in an embodiment of this application;
[0032] Figure 11 This is a hardware structure block diagram of a server for a page file generation method provided in an embodiment of this application;
[0033] Figure 12 This is a schematic diagram of the structure of a blockchain system provided in an embodiment of this application. Detailed Implementation
[0034] Cloud computing refers to the delivery and usage model of IT infrastructure, meaning obtaining necessary resources in an on-demand and easily scalable manner through a network. In a broader sense, cloud computing also refers to the delivery and usage model of services, meaning obtaining necessary services in an on-demand and easily scalable manner through a network. These services can be IT and software related, internet-related, or other services. Cloud computing is a product of the development and integration of traditional computer and network technologies such as grid computing, distributed computing, parallel computing, utility computing, network storage technologies, virtualization, and load balancing.
[0035] The technical solution of this application embodiment can utilize cloud computing and cloud storage technologies to provide resource data services such as style data for page file generation. Cloud storage is a new concept that extends and develops from the concept of cloud computing. A distributed cloud storage system (hereinafter referred to as a storage system) refers to a storage system that uses cluster applications, grid technology, and distributed storage file systems to aggregate a large number of storage devices (also called storage nodes) of various types in the network through application software or application interfaces to work together and jointly provide data storage and business access functions to the outside world.
[0036] Currently, the storage method in storage systems is as follows: Logical volumes are created. During creation, physical storage space is allocated to each logical volume. This physical storage space may consist of a single storage device or the disks of several storage devices. Clients store data on a logical volume, which means storing the data on the file system. The file system divides the data into many parts, each part being an object. Each object contains not only the data but also additional information such as a data identifier (ID, ID entity). The file system writes each object to the physical storage space of that logical volume and records the storage location information of each object. Therefore, when a client requests access to data, the file system can allow the client to access the data based on the storage location information of each object.
[0037] 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 of ordinary skill in the art without creative effort are within the scope of protection of this application.
[0038] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or server 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 devices.
[0039] Before providing a further detailed description of the embodiments of this application, the nouns and terms involved in the embodiments of this application will be explained, and the nouns and terms involved in the embodiments of this application shall be interpreted as follows.
[0040] Web performance is an objective metric that measures the time it takes for a page to load and become interactive and responsive, as well as the smoothness of page interaction. It directly affects the user's intuitive experience of loading time and runtime.
[0041] DCache (Distributed Memcache) is a distributed NoSQL (non-relational Structured Query Language) storage system based on the TARS (an open-source microservice governance framework) microservice governance solution. It supports various data structures such as key-value (kv), key-row (kk-row), list, set, and sorted set (zset). Data is stored in memory and can be persisted by connecting to a database.
[0042] A database, simply put, can be viewed as an electronic filing cabinet—a place to store electronic files, where users can perform operations such as adding, querying, updating, and deleting data. A "database" is a collection of data stored together in a certain way, capable of being shared by multiple users, with minimal redundancy, and independent of application programs.
[0043] A Database Management System (DBMS) is a computer software system designed to manage databases, generally possessing basic functions such as storage, retrieval, security, and backup. DBMSs can be classified according to the database model they support, such as relational or XML (Extensible Markup Language); or according to the type of computer they support, such as server clusters or mobile devices; or according to the query language used, such as SQL (Structured Query Language) or XQuery; or according to performance priorities, such as maximum scale or maximum operating speed; or other classification methods. Regardless of the classification method used, some DBMSs can cross categories, for example, supporting multiple query languages simultaneously.
[0044] Please see Figure 1 , Figure 1 This is a schematic diagram of an application environment provided in an embodiment of this application, such as... Figure 1 As shown, the application environment may include at least server 01 and terminal 02. In practical applications, server 01 and terminal 02 can be directly or indirectly connected via wired or wireless communication to enable interaction between terminal 02 and server 01. This application does not impose any restrictions on this.
[0045] In this embodiment, server 01 can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing 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, CDN (Content Delivery Network), and big data and artificial intelligence platforms. Specifically, the server can include physical devices, such as network communication units, processors, and memory, and software running on the physical devices, such as applications. In this embodiment, server 01 can receive page loading requests sent by terminals, respond to page loading requests, obtain the target page data and corresponding type information required to generate the target page file based on the information carried by the request, determine whether target simplified style data exists based on the type information, and then generate the target page file based on the target page data and the target simplified style data or full style data. Specifically, if target simplified style data does not exist, server 01 can also trigger and execute the corresponding full style data simplification process and store the obtained simplified style data.
[0046] In this embodiment, terminal 02 may include physical devices such as smartphones, desktop computers, tablets, laptops, digital assistants, augmented reality (AR) / virtual reality (VR) devices, smart TVs, smart speakers, smart wearable devices, and in-vehicle terminal devices, and may also include software running on the physical device, such as applications. Specifically, terminal 02 can respond to a user's page loading request by sending a page loading request to server 01, receiving a target page file sent by server 01, rendering it to display the target page to the user, or receiving the rendering result of the target page file sent by server 01 and displaying the corresponding target page to the user.
[0047] In addition, it should be noted that, Figure 1 The example shown is merely an application environment for one page file generation method. This application environment may include more or fewer nodes, and this application does not impose any restrictions here.
[0048] The following describes a page file generation method of this application based on the above application environment, which is applied to the server side. Figure 2This is a flowchart illustrating a page file generation method provided in an embodiment of this application. This specification provides method operation steps as shown in the embodiments or flowcharts, but based on conventional or non-inventive methods, more or fewer operation steps may be included. The order of steps listed in the embodiments is merely one possible execution order among many and does not represent the only possible execution order. In actual system or server product execution, the method can be executed sequentially according to the embodiments or drawings, or in parallel (e.g., in a parallel processor or multi-threaded processing environment). Specifically, as shown... Figure 2 As shown, the method may include:
[0049] S201: Receive a page load request sent by the terminal. The page load request includes page information.
[0050] In this embodiment, the terminal can receive a page loading operation triggered by the user to generate a page loading request and send it to the server to trigger a page file generation operation. In some cases, the user can submit a page resource identifier by launching an application or submitting a network address (a URL, or a Uniform Resource Locator, address) to trigger the page loading operation. Alternatively, the user can trigger the page loading operation by submitting search parameters such as search terms. Accordingly, the page information may include, but is not limited to, page resource identifiers and / or search parameters. In some cases, the page information may also include request identifier information, such as a user identifier, a region identifier, or a page version number. Different page resource identifiers, search parameters, and request identifiers can correspond to different page data. In some cases, when the page resource identifier and / or search parameters are the same, but the request identifier (such as a user identifier or page version number) is different, the corresponding page data may also be different. It should be noted that the content of the page information is not limited to the above description and may also include other information that corresponds to the page data of the page (such as a dynamic page). This application does not impose any restrictions on this.
[0051] S203: Obtain the target page data and the type information of the target page data corresponding to the page information.
[0052] In this embodiment, the target page data includes one or more sets of content data to be displayed on the target page, which may include corpus data, image data, or video data, etc., and there is a correspondence between the content data and the page information. In some cases, the correspondence between page resource identifiers and / or search parameters and content data can be pre-built. After the server parses the page loading request to obtain the page resource identifier and / or search parameters, it searches for and retrieves the corresponding content data from the content database, and determines the corresponding content data as the target page data. For example, the search parameters can be search parameters generated based on user-submitted search terms. The target page data is determined according to the pre-built correspondence between the search parameters and content data. Please refer to [reference needed]. Figure 3 , Figure 3 This illustration shows a sample search result homepage from an embodiment of this application. A user submits the search term "XX game" in the browser's search bar. The terminal generates search parameters based on these parameters and sends them to the server. The server then uses these search parameters to obtain content data such as images and text related to "download," "mini-program," and "video," for use in generating search results. Figure 3 The target page.
[0053] In practical applications, the type information of the target page data includes the data type information and the display type information of the target page data. Please refer to [reference needed]. Figure 4 Step S203 may specifically include:
[0054] S2031: Obtain the target page data and the data type information of the target page data corresponding to the page information.
[0055] In specific embodiments, target page data and corresponding data type information can be obtained simultaneously based on page information, or the data type information corresponding to the target page data can be determined after obtaining the target page data. The data type information characterizes the data type of each content data in the target page data, and may specifically include data type identifiers, etc. In some embodiments, a data list including data type information and target page data can be obtained based on page information. The data type information may include the data type identifiers of each content data in the target page data. Specifically, the content data in the target page data are usually different from each other, but the data type of each content data can be the same. For example, the data type identifiers of the first 5 content data items in the target page data obtained based on the search term "XX game" can be dataname1, dataname2, dataname3, dataname4, etc., where the data types of the third and fourth content data items are the same.
[0056] S2032: Based on the preset correspondence between data types and display types, obtain the display type information corresponding to the data type information to obtain the type information of the target page data.
[0057] In specific embodiments, the display type represents the interface type required to display content data, such as the UI (User Interface) type. In some cases, the same data type corresponds to the same display type, and there is a one-to-one correspondence between data types and display types, or the same data type corresponds to the same display type, while different data types can also correspond to the same display type. A preset correspondence between data types and display types can be maintained based on methods such as hash tables. Based on this preset correspondence, the display type corresponding to each data type in the data type information is determined, thereby obtaining the corresponding display type information.
[0058] S205: Determine the simplified style data associated with the page information.
[0059] In this embodiment, the associated simplified style data is pre-stored simplified style data that has a correlation with page information. A style cache database can be pre-built to store simplified style data and corresponding simplified style information. In some embodiments, the simplified style information may include lifecycle information of the simplified style data, etc. The simplified style data stored in the style cache database is obtained by simplifying the full style data corresponding to the type information of the matched page data. Specifically, the simplified style data is obtained by determining the corresponding type information based on the page information carried by historical page loading requests before the current page load request, and then simplifying the full style data corresponding to that type information. In some embodiments, the style data in this application may be CSS (Cascading Style Sheets) data.
[0060] In practical applications, the association between simplified style data and page information can be preset, or the association between simplified style data and partial information within the page information, such as search parameters or page resource identifiers, can be preset. Each piece of page information can correspond to one or more sets of simplified style data; that is, the associated simplified style data can include one or more sets of simplified style data. When page information matches each other, their associated simplified style data is the same. For example, the style cache database uses search parameters as the primary index. The server can read the simplified style data corresponding to each composite index under this primary index from the style cache database based on the search parameters in the page information to determine the associated simplified style data. In a specific embodiment, the associated simplified style data can be a queue, with each queue containing simplified style data and simplified style information.
[0061] It should be noted that the style cache database may not pre-store the simplified style data associated with the page information. Therefore, it is necessary to determine whether there is matching index information based on the page information. If so, it is determined that there is associated simplified style data. For example, it is determined whether there is a main index that matches the search parameters.
[0062] S207: Obtain target simplified style data from the associated simplified style data that matches the type information of the target page data.
[0063] In this embodiment, the target simplified style data is obtained by simplifying the full style data corresponding to the type information of the target page data. The target simplified style data is simplified style data that matches the page information and type information. When the page information and type information match each other, their corresponding simplified style data are the same.
[0064] In practical applications, after the server obtains the page information and type information, it can determine the simplified style data associated with the page information from the pre-stored simplified style data according to the data storage mapping relationship. Then, it can determine whether there is target simplified style data that matches the type information in the associated simplified style data. If so, the target simplified style data is obtained.
[0065] In some embodiments, the aforementioned simplified database can be constructed based on DCache storage technology, and simplified style data can be stored using a multi-key, multi-value field data structure. Specifically, a primary key and a sub-key can be set as the primary index and composite index for the value. Storage follows a primary index-composite index-value structure, and the value corresponding to each composite index can be retrieved through the primary index. For example, a primary index can be generated based on the page resource identifier or search parameters in the page information; alternatively, a primary index can be generated based on the page resource identifier, search parameters, and request identifier, such as using search parameters + page version number as the primary index. Furthermore, composite indexes can be generated based on the type information of the page data corresponding to the page information, where the value is simplified style data and simplified style information. One primary index can correspond to one or more different composite indexes, and each composite index corresponds to a set of simplified style data and corresponding simplified style information. Thus, the target primary index can be determined based on the page information, and then each composite index and its corresponding simplified style data under the target primary index can be determined to identify the associated simplified style data. Then, the target composite index can be determined based on the type information, and then it can be determined whether the target composite index exists in each composite index. If it exists, the simplified style data corresponding to the target composite index is the target simplified style data.
[0066] It should be noted that steps S203 and S205 can be executed serially or in parallel. Specifically, parallel execution is preferred. The process of obtaining the target page data in step S203 takes a relatively long time, which can reach more than 400ms in some cases, while the process of determining the associated simplified style data in step S205 takes a relatively short time, which is estimated to be less than 100ms. Therefore, the time consumption of parallel operation is limited by step S203, and no additional time cost is incurred while obtaining the simplified style data.
[0067] In some cases, the style cache database may not contain matching simplified style data. After obtaining the simplified style data, data type information, and display type information associated with the page information, it is necessary to determine whether there is target simplified style data in the associated simplified style data that matches the data type information and display type information. If so, the target simplified style data is obtained for use in generating the target page file. Accordingly, step S207 may include, please refer to... Figure 5 The method may also include a step to determine whether the target simplified style data exists, specifically including:
[0068] S2071: Obtain the reference index value corresponding to the associated simplified style data.
[0069] Specifically, the reference index value of each simplified style data in the associated simplified style data is obtained, resulting in the corresponding reference index value. There is a one-to-one correspondence between simplified style data and reference index values. The associated simplified style data includes one or more sets of simplified style data, and correspondingly, the corresponding reference index value includes one or more reference index values. Taking the aforementioned style cache data data structure as an example, the reference index value corresponds to the value of the aforementioned composite index, that is, the value of the composite index corresponding to each simplified style data in the associated simplified style data is obtained.
[0070] S2072: Determine the target index value corresponding to the type information of the target page data using a preset index value algorithm.
[0071] As mentioned above, the type information of the target page data includes data type information and display type information. In some embodiments, the data type information includes a data type identifier for the target page data, and the display type information includes a display type identifier corresponding to the data type identifier.
[0072] Accordingly, step S2072 may specifically include:
[0073] 1): De-duplicatively sort the data type identifiers and corresponding display type identifiers of the target page data to obtain the data type identifier sequence and the display type identifier sequence.
[0074] 2): Use a preset index value algorithm to perform index value operations on the data type identifier sequence and the display type identifier sequence to obtain the target index value.
[0075] As mentioned earlier, the target page data includes one or more sets of content data. The data type information includes the data type identifier of each content data in the target page data, and the display type information includes the display type identifier corresponding to each data type identifier. The data type identifiers and display type identifiers can be sorted according to the display order of the content data to obtain an initial data type sequence and display type sequence. Duplicate data type identifiers in the type sequences are then removed to obtain a data type identifier sequence and a display type identifier sequence.
[0076] Furthermore, reference indexes (such as the aforementioned composite indexes) can be generated based on type information. Type information with the same reference index is considered mutually matching. Assuming page information matches, mutually matching type information corresponds to the same simplified style data. In some cases, during the construction of the style cache database, the data type sequence and display type sequence corresponding to the simplified style data can be concatenated based on a preset indexing algorithm to generate the corresponding reference index. In other cases, the preset indexing algorithm can be an existing hash function, such as a password hash function. The data type sequence and display type sequence can be hashed based on the preset indexing algorithm to obtain the corresponding reference index. Correspondingly, after obtaining the data type identifier sequence and display type identifier sequence, the target index value can be obtained based on the same preset indexing algorithm. This allows us to determine whether a reference index with the same target index value exists in the style cache database, thereby confirming the existence of the target simplified style data.
[0077] In one specific embodiment, the preset index value algorithm is the MD5 (Message-Digest Algorithm) information digest algorithm, which combines the data type identifier sequence and the display type identifier sequence, and uses the MD5 information digest algorithm to calculate the combined sequence result to obtain the target index value.
[0078] For example, the data type information includes five data type identifiers: dataname1, dataname2, dataname3, dataname4, and dataname1. Based on the mapping relationship dataname1→UI1, dataname2→UI2, dataname3→UI3, and dataname4→UI3, the display type identifiers corresponding to each content data in the target page are determined to be: UI1, UI2, UI3, UI3, and UI4. After deduplication and sorting, the resulting data type identifier sequence is dataname1 / dataname2 / dataname3 / dataname4, and the display type identifier sequence is UI1 / UI2 / UI3. These two sequences can be concatenated, and then the MD5 message digest algorithm is used to calculate the target index value from the concatenated result (dataname1 / dataname2 / dataname3 / dataname4-UI1 / UI2 / UI3).
[0079] S2073: Based on the corresponding reference index value and target index value, obtain the target simplified style data from the associated simplified style data.
[0080] In some embodiments, a reference index value that matches or is consistent with the target index value can be determined from the corresponding reference index values. The simplified style data corresponding to this matching or consistent reference index value is then obtained from the associated simplified style data to obtain the target simplified style data. Thus, by establishing the association between type information and simplified style data through a preset index value algorithm, accurate and rapid matching of simplified style data can be achieved.
[0081] In some embodiments, if a reference index value matching or identical to the target index value exists in the corresponding reference index value, it is determined that target simplified style data exists in the associated simplified style data, triggering the step of obtaining the target simplified style data from the associated simplified style data. If no reference index value matching or identical to the target index value exists in the corresponding reference index value, it is determined that target simplified style data does not exist in the associated style data, triggering the following step of obtaining the target full style data.
[0082] S209: Generate a target page file based on the target page data and the target simplified style data. The target page file is used to generate the target page corresponding to the page loading request.
[0083] In this embodiment, after generating the target page file, the server or terminal can render the target page file to obtain the target page corresponding to the page loading request. The terminal then loads and displays the target page on the target interface. In some embodiments, the target page file can be an HTML (Hypertext Markup Language) file.
[0084] Based on some or all of the above implementation methods, there are still cases where the style cache database does not pre-store matching simplified style data. For example, if the target simplified style data is not found in the associated simplified style data, please refer to [the relevant documentation / reference]. Figure 6 The methods also include:
[0085] S211: If the target simplified style data is not found in the associated simplified style data, obtain the target full style data corresponding to the type information of the target page data.
[0086] S213: Generate the target page file based on the target page data and the target full style data.
[0087] In practical applications, if the type information corresponding to the current page information is being retrieved for the first time, the style cache database will not contain a reference index for that type information, meaning the corresponding simplified style data is not stored. Therefore, the target simplified style data will not be present in the associated simplified style data, and the target full style data needs to be retrieved to generate the target page file. Specifically, the server pre-stores the full style data corresponding to each data type and / or display type. Correspondingly, it retrieves the full style data corresponding to the data type and / or display type of each content data in the type information, thereby obtaining the target full style data.
[0088] In some cases, this also includes situations where the style cache database does not pre-store the simplified style data associated with the page information. For example, the style cache database does not contain index information (such as the primary index) corresponding to the page information. Accordingly, the method also includes S215: if there is no simplified style data associated with the page information, the step of obtaining the target full style data corresponding to the type information is triggered.
[0089] Based on some or all of the above implementation methods, in this embodiment of the application, if the target simplified style data is not present in the associated simplified style data, a style simplification request is triggered, and a simplification operation of the target full style data is performed based on the style simplification request. Accordingly, please refer to... Figure 7 After step S211, the method further includes:
[0090] S217: Determine the loading style data corresponding to the target page file. The loading style data is the style data that needs to be loaded during the rendering process of the target page file.
[0091] S219: Based on the loaded style data, the target full style data is simplified to obtain the target simplified style data.
[0092] In practical applications, the style data actually loaded during the rendering process of the target page file can be determined by identifying the API (Application Programming Interface) called by the target page. This yields the loaded style data, which is then matched with the target full style data. Based on the matching result, the target full style data is simplified. It should be noted that the method for determining the loaded style data is not limited to the above description and can be similar to existing technologies; this application does not impose any limitations on this. Specifically, step S219 may include:
[0093] S2191: Identify style data in the target full style data that does not match the loaded style data.
[0094] S2192: Simplify the mismatched style data to obtain the target simplified style data.
[0095] Specifically, based on the style selectors, tag information, and attribute information corresponding to the rendered result of the target page file, style data that does not match the loaded style data in the target full style data can be identified. This mismatched style data is then removed from the target full style data to obtain the target simplified style data. For example, if the target page file is an HTML file, the CSS selectors and HTML tag / class information in the rendered result of the HTML file can be identified, and then the mismatched style data can be determined and simplified.
[0096] S221: Store page information, target page data type information, and target simplified style data in association.
[0097] Specifically, after obtaining the target simplified style data, the page information, type information, and target simplified style data are associated and stored based on a preset data structure to update and expand the style cache database. When a page loading request that matches the current page information and its corresponding type information is received subsequently, the target simplified style data is invoked based on the aforementioned process to improve page file generation efficiency and rendering speed.
[0098] In practical applications, the server can include a web server, a content data server, a style caching server, and a simplification processing server. The web server is used to receive page loading requests sent by the terminal and generate the target page file corresponding to the page loading request. The content data server is used to provide storage and sending services for the target page data. The style caching server has a style cache database to store simplified style data. The simplification processing server is used to respond to style simplification requests and perform simplification operations on all style data. Specifically, the simplification server can generate a simplification task queue corresponding to the style simplification request, consume tasks from the task queue to perform simplification operations, generate simplified style data, and send it to the style caching server.
[0099] Based on the above technical solution, by constructing a correspondence between simplified style data and page information and data types, simplified style data can be quickly matched to generate page files, avoiding loading delays caused by redundant styles. When no simplified style data is matched, the full style data is used to generate page files, triggering style simplification operations simultaneously. This integrates style simplification processing into online business processes, avoiding the time-consuming simplification process from affecting page generation while improving the generation efficiency of subsequent related pages, effectively enhancing web performance and improving user experience.
[0100] Based on some or all of the above implementation methods, in some embodiments, after determining that the target simplified style data does not exist in the associated simplified style data and triggering a style simplification request, the style simplification operation is directly performed. In other embodiments, to reduce the concurrency of style simplification processing, the number of identical style simplification requests can be recorded to generate and store corresponding request frequency information. After determining that the target simplified style data does not exist and triggering a style simplification request, it is determined whether the corresponding request frequency information meets a preset frequency condition, and then it is determined whether to perform the style simplification operation based on the determination result. Accordingly, before step S217, the method further includes:
[0101] S301: Obtain the corresponding request frequency information based on the page information and the type information of the target page data.
[0102] Specifically, the request frequency information represents the number of times the same style simplification request is triggered within a first preset duration. This can be the number of requests triggered within the past first preset duration since the current time, or the number of requests triggered within each first preset duration unit. Specifically, counting begins from the initial request generation, using the first preset duration as the time unit, and restarts counting every first preset duration. The time interval between adjacent counting time nodes is the first preset duration. For example, if the first preset duration is 1 minute, then the request frequency information represents the number of times the same style simplification request is triggered within the past 1 minute, or the number of times the same style simplification request is triggered from the previous counting time node to the current time. Accordingly, for the former case, when recording the number of requests for the same style of simplification, it is also necessary to set the expiration time for each request. After the expiration, the record is cleared, and the validity period of each request record is the first preset duration. For the latter case, it is also necessary to set the expiration time for the overall request frequency information. The interval between adjacent expiration times is the first preset duration. After the expiration, the request frequency information is deleted, and the counting starts again.
[0103] Specifically, page load requests that match each other in both page information and type information trigger the same style reduction requests. In some cases, a request index can be generated based on page information and type information. Requests with the same style reduction request will have the same request index. Then, a mapping relationship between the request index and request frequency information can be established to facilitate subsequent retrieval of request frequency information based on page information and type information.
[0104] In one specific embodiment, the request index can be set based on the primary index and composite index (reference index) of the simplified style data. For example, the concatenation result of the primary index and composite index can be used as the request index for the corresponding simplified style request.
[0105] S302: If the request frequency information meets the preset frequency conditions, trigger the step of determining the loading style data corresponding to the target page file to perform style simplification operation.
[0106] In some embodiments, the number of requests for the current style simplification request within a first preset time period can be determined based on request frequency information. If the number of requests is greater than a preset number, the request frequency information is determined to meet the preset frequency condition; otherwise, it is not. If it is not met, the step of determining the loading style data corresponding to the target page file is not triggered, the style simplification processing operation is not performed, and the currently triggered style simplification requests are counted to update the request frequency information. Request frequency information can filter low-frequency style simplification needs, avoid unnecessary style simplification operations, reduce the amount of style simplification data and the concurrency of simplification processing, and improve simplification efficiency.
[0107] Based on some or all of the above implementation methods, in the embodiments of this application, the simplified style information may include the lifecycle information of the simplified style data, and correspondingly, the method may also include S223: obtaining the lifecycle information of the target simplified style data.
[0108] Accordingly, after step S207, the method further includes S225: extending the effective duration of the target simplified style data based on lifecycle information.
[0109] In practical applications, lifecycle information includes the expiration time of simplified style data and its invocation time. Specifically, when simplified style data is initially generated and stored, an expiration time is generated based on the storage time and a preset lifecycle. The duration corresponding to the preset lifecycle is the validity period of the data. The simplified style data is valid from the storage time to the expiration time. For example, if the preset lifecycle is 2 hours, the data validity period is 2 hours, and the storage time of the simplified style data is T1, then the expiration time of the simplified style data is T1+2 hours, and the data is valid from T1 to T1+2 hours. If the simplified style data is determined to be the target simplified style data, the expiration time of the target simplified style data can be updated, and the invocation time of the simplified style data can be recorded to update its lifecycle information. This allows the validity period to be extended by a second preset duration from the current expiration time or from the current invocation time. In some cases, the second preset duration can be the duration corresponding to one or more preset lifecycles. Based on the above example, if the second preset duration is 2 hours, the effective duration of the target simplified style data is extended to 4 hours, and the expiration time is updated to T1+4 hours; or the current call time is T2, and the expiration time is updated to T2+2 hours. Furthermore, if the target simplified style data is called again before the updated expiration time, the above process is repeated to update its expiration time and call time again, thereby extending the effective duration and updating the lifecycle information. It should be noted that the second preset duration can be set based on actual needs and is not limited to the above description.
[0110] Furthermore, the method can detect whether the simplified style data is expired based on lifecycle information. In some cases, if it is determined to be expired data, the corresponding simplified style data is deleted from the style cache database, while the primary index and composite index, as well as the corresponding lifecycle information, are retained. Accordingly, after step S207, the method further includes: if it is determined based on the lifecycle information that the target simplified style data is not expired data, step S209 is triggered. If it is determined based on the lifecycle information that the target simplified style data is expired data, that is, although it is determined that there is index information matching the page information and type information, but there is no target simplified style data, the step of obtaining the target full style data corresponding to the type information of the target page data is triggered. In other cases, if it is determined to be expired data, the corresponding simplified style data, as well as the corresponding index information and lifecycle information, are deleted, and the corresponding index information will not be matched in the style cache database, directly triggering the step of obtaining the target full style data.
[0111] In some embodiments, a preset extension period can be set to control the effective duration of simplified style data. The lifecycle information also includes the extension period of the simplified style data, which is the total duration of the simplified style data that has been extended. Specifically, the method further includes: if the extension period of the simplified style data exceeds the preset extension period, the simplified style data is determined to be expired data.
[0112] By setting lifecycle information for simplified style data and corresponding cache expiration policies, the scale of cached data can be effectively controlled, reducing server-side system pressure and storage resource waste. Furthermore, extending the validity period of simplified style data when it is accessed helps retain frequently accessed simplified style data, reducing redundant processing of style simplification and thus minimizing performance waste.
[0113] The following combination Figure 8 This application introduces a system for generating application page files. Figure 8 A schematic diagram of the framework of a system provided in an embodiment of this application is shown. Please refer to... Figure 8 The system includes a terminal and a server. As mentioned above, the server may include a web server, a content data server, a style caching server, and a simplification processing server.
[0114] Specifically, the content data server constructs a simplified style database, DCache1, based on DCache storage technology to store simplified style results. The simplification processing server runs style simplification processing containers, including DCache2, DCache3, and DCache4, all built on DCache storage technology. DCache2 stores request frequency information for simplified style requests, DCache3 stores the style simplification task queue, and DCache4 stores the raw data for the style simplification task queue, including full style data and page files. The simplification processing server also uses the style simplification task queue and raw data stored in DCache3 and DCache4 to consume tasks, such as executing various tasks in the simplification task queue using multi-threading to obtain simplified style results, which are then stored in DCache1 to update the simplified style database.
[0115] Specifically, DCache1 stores data using a multi-key, multi-value data structure. In one example, its primary key (primary index) is the page version number + query (search parameters), and the secondary key (composite index / reference index) is a subkey calculated based on data type and display type information. DCache2's data structure can be key-value. In one example, DCache2's key is the concatenation of the primary and secondary keys in DCache1 (primary key + secondary key), and the value is request frequency information. DCache3 can include a task queue, and its data structure can be key-ZSet. DCache3's key is a fixed value, and the value is a set with a score, where the score can be the timestamp when the style simplification task enters the queue. The value is the primary key + secondary key of DCache1. DCache4's data structure can be key-value. DCache4's key is the primary key + secondary key of DCache1, and the value is the raw data including the full target style data to be simplified. The raw data can also include the target page file or the corresponding loaded style data of the target page file, such as the full CSS and HTML file for the first screen.
[0116] Specifically, task queue creation involves sending a primary key and a secondary key from DCache1, with the current timestamp as the fraction, to DCache3. Simultaneously, the original data is stored in DCache4, using the primary key and secondary key to establish a mapping relationship. During task consumption, the earliest task can be retrieved from DCache3 each time, and the corresponding original data can be read from DCache4.
[0117] It should be noted that the system architecture, data storage scheme, and simplified task processing scheme of this application are not limited to the above description, and can also be implemented using existing technologies. This application does not impose any restrictions on these aspects.
[0118] The following describes the page file generation method of this application in a specific application scenario. This method is applied to the server side; please refer to the documentation. Figure 9 , Figure 9 A flowchart of the page file generation method in this embodiment is shown. The page file generation method in this embodiment can be based on the above. Figure 8 The system execution within.
[0119] S1: Receive a page loading request sent by the receiving terminal, which carries page information.
[0120] Specifically, the terminal receives the search terms submitted by the user through the browser to generate a page loading request, which is then sent to the web server. The page information includes the page version number and search parameters generated based on the search terms. The web server can be a Node server.
[0121] S2: Retrieve the target page data and the corresponding data type information corresponding to the page information.
[0122] Specifically, in response to a page load request, the web server requests content data corresponding to the page information from the content data server, such as content data corresponding to search parameters. The content data server then returns a data list to the web server, including multiple pieces of content data and data type information. The data type information includes a data type identifier for each piece of content data, such as using the field `dataname` as the data type identifier. In one example, if the search term is "XX game", the target page data list includes five pieces of content data: `data1`, `data2`, `data3`, `data4`, and `data5`. The data type information includes five corresponding data type identifiers: `dataname1`, `dataname2`, `dataname3`, `dataname4`, where the third and fourth pieces of content data have the same data type.
[0123] S3: Obtain the display type information corresponding to the data type information based on the preset correspondence between data type and display type.
[0124] Specifically, the web server pre-stores the aforementioned pre-defined mapping relationships, such as a one-to-one correspondence between data types and display types, or the same data type can correspond to the same display type, while the same display type can correspond to multiple data types. In the example above, the mapping relationship is dataname1→UI1, dataname2→UI2, dataname3→UI3, dataname4→UI3. Therefore, the display types corresponding to each content data in the data list are UI1, UI2, UI3, UI4, respectively.
[0125] S4: Determine whether there is simplified style data associated with the page information in the style cache database. If the result is yes, proceed to step S5; if the result is no, proceed to step S8.
[0126] Specifically, the existence of related simplified style data can be determined based on the index information in the style cache data and the current page information. The style cache database is built on the style cache server. As mentioned above, its data storage structure is main index - reference index - value. In one example, the main index is the search parameter or search parameter + page version number, the reference index is obtained by indexing data type information and display type information using a preset indexing algorithm (see the previous content for details), and the value is the simplified style data.
[0127] The web server uses the search parameters or search parameters plus the page version number as the main index to query the style cache database to see if the main index exists. If it exists, it determines that the style cache database contains related simplified style data.
[0128] In one example, if the main index is query + page version number (e.g., XX game + page version number), based on the data structure main key (main index) - subkey (reference index) - value (CSS), the reference indices under this main index are subkey1, subkey2, subkey3 and subkey4. Then the associated simplified style data corresponding to this main index includes: value1 (CSS1), value2 (CSS2), value3 (CSS3) and value4 (CSS4).
[0129] It should be noted that steps S2 and S4 are executed in parallel, and S2 and S4 can be triggered simultaneously.
[0130] S5: Based on the data type and display type information, determine whether the target simplified style data exists in the associated simplified style data. If the result is yes, proceed to step S6; if the result is no, proceed to steps S8 and S11. It should be noted that S8 and S11 can be executed serially or in parallel. In the case of parallel execution, S8 and S11 can be triggered simultaneously.
[0131] Specifically, the web server determines whether there is simplified style data that matches the page information and data type information. The specific implementation method can be found in the preceding content. In the example above, based on the matching of the reference index value, it is determined that the obtained target index value is consistent with the value of subKey2. Therefore, the target simplified style data is the simplified style data CSS2 corresponding to subKey2. As mentioned earlier, it is also possible to determine whether CSS2 is expired data based on lifecycle information. If not, step S6 is executed; if so, steps S8 and S11 are executed.
[0132] S6: Obtain the target simplified style data.
[0133] Specifically, the web server obtains the target simplified style data from the style cache server.
[0134] S7: Generate the target page file based on the target page data and the target simplified style data.
[0135] Specifically, if target simplified style data exists, the web server obtains the target simplified style data from the style cache server, generates the target page file, and then executes step S10.
[0136] S8: Retrieve data type information and display the target full style data corresponding to the display type information.
[0137] S9: Generate the target page file based on the target page data and the target full style data.
[0138] Specifically, after determining that there is no target simplified style data, the web server directly obtains the original style data, that is, obtains the target full style data, and then performs the target page file generation operation.
[0139] In one example, the page load request is for the first screen of the page. Accordingly, if the target simplified style data is not matched, the HTML fragment of the target page file corresponding to the first screen of the page generated by the web server is as follows:
[0140]
[0141] {First-screen CSS resources, including common resources and all CSS resources for UI1, UI2, and UI3}
[0142]
[0143]
[0144] {HTML snippet from the first screen directly output}
[0145] {Homepage JavaScript resources, including common resources, and JavaScript resources for UI1, UI2, and UI3 (in CDN link format)}
[0146] {The remaining JS and CSS resources (in CDN link format)}
[0147]
[0148] If the target simplified style data is matched, the original target full style data will be replaced with the target simplified style data. The corresponding HTML snippet is shown below:
[0149]
[0150] {The first screen's CSS resources, currently showing the simplified style data (CSS2) corresponding to value2}
[0151]
[0152]
[0153] {HTML snippet from the first screen directly output}
[0154] {Homepage JavaScript resources, including common resources, and JavaScript resources for UI1, UI2, and UI3 (in CDN link format)}
[0155] {The remaining JS and CSS resources (in CDN link format)}
[0156]
[0157] S10: Render the target page file to obtain the target page.
[0158] Specifically, if the web server returns the target page file to the browser, the browser's page rendering process can include the following:
[0159] (1) Load {first screen CSS resources, including common resources, CSS resources of UI1, UI2, and UI3};
[0160] (2) Load the {direct output first screen HTML fragment}, at which point the first screen page can be displayed;
[0161] (3) Load {the first screen JS resources, including public resources, and the JS resources of UI1, UI2, and UI3 (in CDN link form)}. At this time, the first screen page can realize page interaction (e.g., jump click).
[0162] (4) Load {the remaining js and css resources (in CDN link form)}.
[0163] Alternatively, it can specifically include:
[0164] (1) Load {first screen CSS resources, the simplified style data CSS2 corresponding to value2};
[0165] (2) Load the {direct output first screen HTML fragment}, at which point the first screen page can be displayed;
[0166] (3) Load {the first screen JS resources, including public resources, and the JS resources of UI1, UI2, and UI3 (in CDN link form)}. At this time, the first screen page can realize page interaction (e.g., jump click).
[0167] (4) Load {the remaining js and css resources (in CDN link form)}.
[0168] S11: Triggers a style simplification request corresponding to page information, data type information, and display type information.
[0169] Specifically, if the target simplified style data is not matched, the web server sends a simplification request to the simplification processing server, which triggers the style simplification request so that the simplification processing server can perform the corresponding simplification processing operation.
[0170] S12: Get the request frequency information for style simplification requests.
[0171] S13: Determine whether the request frequency information meets the preset frequency conditions. If the determination result is yes, proceed to step S14; if the determination result is no, proceed to step S17.
[0172] S14: Determine the loading style data corresponding to the target page file.
[0173] S15: Based on the loaded style data, the target full style data is simplified to obtain the target simplified style data.
[0174] S16: Associate storage page information, data type information, display type information, and target simplified style data.
[0175] S17: Update the request frequency information for style simplification requests.
[0176] Specifically, the server-side simplification process obtains request frequency information and determines whether it meets preset frequency conditions. Based on the result, it decides whether to perform style simplification. If it decides to execute, it determines the actual style data required for rendering the target page file. Then, it generates simplification task items in the task queue and executes the corresponding task consumption to simplify the target full style data. After obtaining the target simplified style data, it is associated with page information and type information and stored in the style cache server, such as using the storage scheme of the aforementioned system.
[0177] In one example, the first-screen page generation time after optimization based on the page file generation scheme of this application and the first-screen page generation time before optimization are shown in Table 1 below. As can be seen from the results, the page generation method based on this application can effectively improve page generation efficiency and significantly improve web performance.
[0178] Table 1
[0179]
[0180] This application also provides a page file generation device 700, such as... Figure 10 As shown, Figure 10 This illustration shows a schematic diagram of a page file generation apparatus according to an embodiment of this application. The apparatus may include:
[0181] Request receiving module 10: Used to receive page loading requests sent by the terminal, the page loading requests including page information;
[0182] Page data acquisition module 20: used to acquire the target page data and the type information of the target page data corresponding to the page information;
[0183] Module 30 for determining associated style data: This module is used to determine the simplified style data associated with the page information. The simplified style data is obtained by simplifying the full style data corresponding to the type information of the matched page data.
[0184] Target style data acquisition module 40: Acquires target simplified style data that matches the type information of the target page data from the associated simplified style data;
[0185] Page file generation module 50: Used to generate target page files based on target page data and target simplified style data. The target page file is used to generate the target page corresponding to the page loading request.
[0186] In some embodiments, the type information of the target page data includes data type information and display type information of the target page data, and the page data acquisition module 20 includes:
[0187] Page data acquisition unit: used to acquire the target page data and the data type information of the target page data corresponding to the page information;
[0188] Display type information acquisition unit: Based on the preset correspondence between data type and display type, it acquires the display type information corresponding to the data type information in order to obtain the type information of the target page data.
[0189] In some embodiments, the target style data acquisition module 40 includes:
[0190] Reference index value acquisition unit: used to acquire the reference index value corresponding to the associated simplified style data before acquiring the target simplified style data that matches the type information of the target page data from the associated simplified style data;
[0191] Target index value determination unit: used to determine the target index value corresponding to the type information of the target page data using a preset index value algorithm;
[0192] First style data matching unit: used to obtain target simplified style data from associated simplified style data based on the corresponding reference index value and target index value.
[0193] In some embodiments, the apparatus further includes:
[0194] Full style data acquisition module: If the target simplified style data is not found in the associated simplified style data, the full style data corresponding to the type information of the target page data will be obtained.
[0195] The page file generation module 50 is also used to generate a target page file based on the target page data and the target full style data.
[0196] In some embodiments, the apparatus further includes:
[0197] The style data loading determination module is used to determine the loading style data corresponding to the target page file after obtaining the target full style data corresponding to the type information of the target page data if the target simplified style data does not exist in the associated simplified style data. The loading style data is the style data that needs to be loaded during the rendering process of the target page file.
[0198] Simplification module: Used to simplify the target full style data based on the loaded style data to obtain the target simplified style data;
[0199] Style data storage module: Used to associate and store page information, target page data type information, and target simplified style data.
[0200] In some embodiments, the simplification module includes:
[0201] The second style data matching unit is used to determine the style data in the target full style data that does not match the loaded style data.
[0202] Simplification unit: Used to simplify mismatched style data to obtain the target simplified style data.
[0203] In some embodiments, the apparatus further includes:
[0204] Request frequency information acquisition unit: used to acquire the corresponding request frequency information based on page information and target page data type information before determining the loading style data corresponding to the target page file;
[0205] Simplified processing trigger unit: If the request frequency information meets the preset frequency conditions, it triggers the step of determining the loading style data corresponding to the target page file.
[0206] In some embodiments, the apparatus further includes:
[0207] Lifecycle information acquisition module: used to acquire lifecycle information of the target simplified style data;
[0208] Effective Duration Update Module: After obtaining target simplified style data that matches the type information of the target page data from the associated simplified style data, the module extends the effective duration of the target simplified style data based on the lifecycle information.
[0209] In some embodiments, the data type information includes a data type identifier for the target page data, and the display type information includes a display type identifier corresponding to the data type identifier; the target index value determination unit includes:
[0210] Type sorting subunit: used to sort the data type identifiers and corresponding display type identifiers of the target page data to obtain the data type identifier sequence and the display type identifier sequence respectively;
[0211] Index value operation subunit: Used to perform index value operation on the data type identifier sequence and the display type identifier sequence using a preset index value algorithm to obtain the target index value.
[0212] The above-described apparatus and method embodiments are based on the same implementation methods.
[0213] This application provides a page file generation device, which includes a processor and a memory. The memory stores at least one instruction or at least one program segment, which is loaded and executed by the processor to implement the page file generation method provided in the above method embodiments.
[0214] Memory is used to store software programs and modules. The processor executes these stored software programs and modules to perform various functional applications and data processing. Memory can primarily consist of a program storage area and a data storage area. The program storage area stores the operating system, application programs required for functionality, etc.; the data storage area stores data created based on device usage, etc. Furthermore, memory can include high-speed random access memory (RAM) and non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, memory can also include a memory controller to provide the processor with access to the memory.
[0215] The methods and embodiments provided in this application can be executed on mobile terminals, computer terminals, servers, or similar computing devices. Taking running on a server as an example, Figure 11 This is a hardware structure block diagram of a server for a page file generation method provided in an embodiment of this application. For example... Figure 11 As shown, the server 800 can vary significantly due to different configurations or performance. It may include one or more central processing units (CPUs) 810 (CPUs 810 may include, but are not limited to, microprocessors such as MCUs or programmable logic devices such as FPGAs), a memory 830 for storing data, and one or more storage media 820 (e.g., one or more mass storage devices) for storing application programs 823 or data 822. The memory 830 and storage media 820 may be temporary or persistent storage. The program stored in the storage media 820 may include one or more modules, each module may include a series of instruction operations on the server. Furthermore, the CPU 810 may be configured to communicate with the storage media 820 and execute the series of instruction operations stored in the storage media 820 on the server 800. Server 800 may also include one or more power supplies 860, one or more wired or wireless network interfaces 850, one or more input / output interfaces 840, and / or one or more operating systems 821, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, etc.
[0216] The input / output interface 840 can be used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by the communication provider of server 800. In one example, the input / output interface 840 includes a network interface controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the input / output interface 840 may be a radio frequency (RF) module used for wireless communication with the Internet.
[0217] Those skilled in the art will understand that Figure 11 The structure shown is for illustrative purposes only and does not limit the structure of the aforementioned electronic device. For example, server 800 may also include... Figure 11 The more or fewer components shown, or having the same Figure 11 The different configurations shown.
[0218] Embodiments of this application also provide a computer-readable storage medium, which can be disposed in a server to store at least one instruction or at least one program related to implementing a page file generation method in the method embodiments. The at least one instruction or the at least one program is loaded and executed by the processor to implement the page file generation method provided in the above method embodiments.
[0219] Optionally, in this embodiment, the storage medium may be located at at least one of the multiple network servers in a computer network. Optionally, in this embodiment, the storage medium may include, but is not limited to, various media capable of storing program code, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.
[0220] In the embodiments of this application, the page file generation method or apparatus disclosed in this application can operate in such a way as... Figure 12 One or more servers may be configured to form a blockchain, thereby providing data storage and other services for the page file generation method or apparatus. For example, one or more of the simplified style data, full style data, content data, request frequency information, and simplified task queue of this application may be stored in the aforementioned blockchain, and the server is a node on the blockchain. Figure 12 This is a schematic diagram of the structure of a blockchain system provided in an embodiment of this application. For example... Figure 12As shown, the server can be a node 920 in the distributed system 910, which can be a blockchain system. The blockchain system can be a distributed system formed by multiple nodes connected through network communication. The nodes can form a peer-to-peer (P2P) network. Any form of computer device, such as a server, terminal 02, or other electronic device, can become a node in the blockchain system by joining the peer-to-peer network. The blockchain includes a series of blocks that are sequentially generated according to their time sequence. Once a new block is added to the blockchain, it will not be removed. The blocks record the data submitted by the nodes in the blockchain system.
[0221] Blockchain is an emerging application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanisms, and encryption algorithms. Essentially, it's a decentralized database, a chain of data blocks linked using cryptographic methods. Each data block contains information about a batch of network transactions, used to verify the validity of the information (anti-counterfeiting) and generate the next block. A blockchain can include a blockchain underlying platform, a platform product service layer, and an application service layer. The blockchain underlying platform can include processing modules such as user management, basic services, smart contracts, and operational monitoring. The user management module is responsible for managing the identity information of all blockchain participants, including maintaining public and private key generation (account management), key management, and maintaining the correspondence between user real identities and blockchain addresses (access management). Under authorization, it manages and audits transactions of certain real identities, providing risk control rule configuration (risk control audit). The basic service module is deployed on all blockchain node devices to verify the validity of business requests. After consensus is reached on valid requests, they are recorded in storage. For a new business request, the basic service first performs interface adaptation parsing and authentication (interface adaptation), and then encrypts the business information using a consensus algorithm (consensus management). The blockchain process involves several key steps: First, encryption and secure transmission of data to the shared ledger (network communication) for recording and storage. Second, the smart contract module handles contract registration, issuance, triggering, and execution. Developers can define contract logic using a programming language and publish it to the blockchain (contract registration). Execution is triggered by calling keys or other events based on the contract terms, completing the contract logic. The module also provides contract upgrade and cancellation functionality. Third, the operation and monitoring module handles deployment, configuration modification, contract settings, cloud adaptation, and real-time visualization of the product's operational status, including alerts, network status monitoring, and node device health monitoring. The platform's product service layer provides basic capabilities and implementation frameworks for typical applications. Developers can leverage these capabilities and add business characteristics to implement business logic on the blockchain. Finally, the application service layer provides blockchain-based application services to business stakeholders.
[0222] According to one aspect of this application, a computer program product or computer program is provided, comprising computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the methods provided in the various alternative implementations described above.
[0223] As can be seen from the embodiments of the page file generation method, apparatus, device, server, or storage medium provided in this application, after receiving a page loading request carrying page information sent by a terminal, this application obtains the target page data and type information of the target page data corresponding to the page information; determines the simplified style data associated with the page information; obtains the target simplified style data matching the type information of the target page data from the associated simplified style data; and generates the target page file based on the target page data and the target simplified style data. The simplified style data is obtained by simplifying the full style data corresponding to the type information of the matched page data. In this way, by pre-storing the simplified style data corresponding to the type information, the target simplified style data required to generate the target page file can be directly obtained, avoiding page loading delays and resource consumption caused by redundant styles, effectively improving page file rendering efficiency, thereby optimizing web performance and alleviating server system pressure.
[0224] It should be noted that the order of the embodiments described above is merely for descriptive purposes and does not represent the superiority or inferiority of the embodiments. Furthermore, the above description focuses on specific embodiments of this application. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps described in the claims can be performed in a different order than that shown in the embodiments and still achieve the desired results. Additionally, the processes depicted in the drawings do not necessarily require a specific or sequential order to achieve the desired results. In some implementations, multitasking and parallel processing are also possible or may be advantageous.
[0225] The various embodiments in this application are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the device, equipment, and storage medium embodiments are basically similar to the method embodiments, so the descriptions are relatively simple; relevant parts can be referred to the descriptions of the method embodiments.
[0226] Those skilled in the art will understand that all or part of the steps of the above embodiments can be implemented by hardware, or by a program instructing the relevant hardware to implement them. The program can be stored in a computer-readable storage medium, such as a read-only memory, a disk, or an optical disk.
[0227] The above are merely preferred embodiments of this application and are not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.
Claims
1. A method for generating page files, characterized in that, The method includes: The terminal receives a page loading request, which includes page information. Obtain the target page data corresponding to the page information and the type information of the target page data. The type information includes the data type information and display type information of the target page data. The display type information is the information corresponding to the data type information obtained based on the preset correspondence between data type and display type. Determine the simplified style data associated with the page information; the simplified style data is obtained by simplifying the full style data corresponding to the type information of the matched page data. Obtain target simplified style data that matches the type information of the target page data from the associated simplified style data; A target page file is generated based on the target page data and the target simplified style data. The target page file is used to generate the target page corresponding to the page loading request.
2. The method according to claim 1, characterized in that, The method further includes: If the target simplified style data is not found in the associated simplified style data, obtain the target full style data corresponding to the type information of the target page data; The target page file is generated based on the target page data and the target full style data.
3. The method according to claim 2, characterized in that, If the target simplified style data is not found in the associated simplified style data, after obtaining the target full style data corresponding to the type information of the target page data, the method further includes: Determine the loading style data corresponding to the target page file, wherein the loading style data is the style data required to be loaded during the rendering process of the target page file; The target full style data is simplified based on the loaded style data to obtain the target simplified style data. The page information, the type information of the target page data, and the target simplified style data are stored together.
4. The method according to claim 3, characterized in that, The step of simplifying the target full style data based on the loaded style data to obtain the target simplified style data includes: Identify style data in the target full style data that does not match the loaded style data; The mismatched style data is simplified to obtain the target simplified style data.
5. The method according to claim 3 or 4, characterized in that, Before determining the loading style data corresponding to the target page file, the method further includes: Obtain the corresponding request frequency information based on the page information and the type information of the target page data; If the request frequency information meets the preset frequency condition, the step of determining the loading style data corresponding to the target page file is triggered.
6. The method according to any one of claims 1-4, characterized in that, The step of obtaining target simplified style data that matches the type information of the target page data from the associated simplified style data includes: Obtain the reference index value corresponding to the associated simplified style data; The target index value corresponding to the type information of the target page data is determined using a preset index value algorithm; Based on the corresponding reference index value and the target index value, the target simplified style data is obtained from the associated simplified style data.
7. The method according to any one of claims 1-4, characterized in that, The method further includes: Obtain the lifecycle information of the target simplified style data; After obtaining target simplified style data that matches the type information of the target page data from the associated simplified style data, the method further includes: The validity period of the target simplified style data is extended based on the lifecycle information.
8. The method according to claim 6, characterized in that, The data type information includes the data type identifier of the target page data, and the display type information includes the display type identifier corresponding to the data type identifier; The step of determining the target index value corresponding to the type information of the target page data using a preset index value algorithm includes: The data type identifiers and corresponding display type identifiers of the target page data are deduplicated and sorted to obtain a data type identifier sequence and a display type identifier sequence; The target index value is obtained by performing index value operations on the data type identifier sequence and the display type identifier sequence using the preset index value algorithm.
9. A page file generation apparatus, characterized in that, The device includes: Request receiving module: used to receive page loading requests sent by the terminal, the page loading request including page information; Page data acquisition module: used to acquire the target page data corresponding to the page information and the type information of the target page data. The type information includes the data type information and display type information of the target page data. The display type information is the information corresponding to the data type information obtained based on the preset correspondence between data type and display type. The associated style data determination module is used to determine the simplified style data associated with the page information; the simplified style data is obtained by simplifying the full style data corresponding to the type information of the matched page data. Target style data acquisition module: used to acquire target simplified style data that matches the type information of the target page data from the associated simplified style data; Page file generation module: used to generate a target page file based on the target page data and the target simplified style data, wherein the target page file is used to generate the target page corresponding to the page loading request.
10. The apparatus according to claim 9, characterized in that, The device further includes: Full style data acquisition module: used to acquire the target full style data corresponding to the type information of the target page data if the target simplified style data does not exist in the associated simplified style data; The page file generation module is also used to generate the target page file based on the target page data and the target full style data.
11. The apparatus according to claim 10, characterized in that, The device further includes: Loading style data determination module: used to determine the loading style data corresponding to the target page file after obtaining the target full style data corresponding to the type information of the target page data if the target simplified style data does not exist in the associated simplified style data, wherein the loading style data is the style data required to be loaded in the rendering process of the target page file; Simplification module: used to simplify the target full style data according to the loaded style data to obtain the target simplified style data; Style data storage module: used to associate and store the page information, the type information of the target page data, and the target simplified style data.
12. The apparatus according to claim 11, characterized in that, The simplification module includes: Second style data matching unit: used to determine style data in the target full style data that does not match the loaded style data; Simplification processing unit: used to simplify the mismatched style data to obtain the target simplified style data.
13. The apparatus according to claim 11 or 12, characterized in that, The device further includes: Request frequency information acquisition unit: used to acquire corresponding request frequency information based on the page information and the type information of the target page data before determining the loading style data corresponding to the target page file; Simplified processing trigger unit: used to trigger the step of determining the loading style data corresponding to the target page file if the request frequency information meets the preset frequency condition.
14. The apparatus according to any one of claims 9-12, characterized in that, The target style data acquisition module includes: Reference index value acquisition unit: used to acquire the reference index value corresponding to the associated simplified style data; Target index value determination unit: used to determine the target index value corresponding to the type information of the target page data using a preset index value algorithm; First style data matching unit: used to obtain the target simplified style data from the associated simplified style data according to the corresponding reference index value and the target index value.
15. The apparatus according to any one of claims 9-12, characterized in that, The device further includes: Lifecycle information acquisition module: used to acquire the lifecycle information of the target simplified style data; Effective Duration Update Module: After obtaining target simplified style data that matches the type information of the target page data from the associated simplified style data, the module extends the effective duration of the target simplified style data based on the lifecycle information.
16. The apparatus according to claim 14, characterized in that, The data type information includes the data type identifier of the target page data, and the display type information includes the display type identifier corresponding to the data type identifier; The target index value determination unit includes: Type sorting subunit: used to sort the data type identifiers and the corresponding display type identifiers of the target page data to obtain a data type identifier sequence and a display type identifier sequence; Index value operation subunit: used to perform index value operation on the data type identifier sequence and the display type identifier sequence using the preset index value algorithm to obtain the target index value.
17. A page file generation device, characterized in that, The device includes a processor and a memory, the memory storing at least one instruction or at least one program, the at least one instruction or the at least one program being loaded and executed by the processor to implement the page file generation method as described in any one of claims 1-8.
18. A computer-readable storage medium, characterized in that, The storage medium stores at least one instruction or at least one program segment, which is loaded and executed by a processor to implement the page file generation method as described in any one of claims 1-8.
19. A computer program product, characterized in that, The computer program product includes computer instructions stored in a computer-readable storage medium; a processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the page file generation method as described in any one of claims 1-8.