Page caching method, device and storage medium
By using the DOM structure page caching method on the client to cache the DOM structure and data of the page, the problem of low page response efficiency in the existing technology is solved, and faster page loading and user experience improvement are achieved.
Patent Information
- Application Number
- CN202111120831.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-24
- Publication Date
- 2024-09-13
- Estimated Expiration
- 2041-09-24
AI Technical Summary
The existing B/S structure system mainly caches data when caching on the client side, and does not cache the page structure and data as a whole, resulting in low user page access efficiency and poor user experience.
Using the page caching method of DOM structure, the client reads the configuration file from the server, obtains the page information set and caches it in the memory, identifies the page identifier in the page access request and compares it with the information set, and extracts or extracts from the memory based on the comparison results or Obtain DOM structure and data from the server for loading and display, and support dynamic configuration page, hotspot access page and FIFO algorithm management.
By caching the DOM structure of the page, it achieves faster page response and rendering, improves the user experience, and supports dynamic configuration and synchronous updates of hotspot access pages in different scenarios.
Smart Images

Figure CN113849752B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of Internet technology, and in particular to a page caching method, device and storage medium. Background Art
[0002] The B / S (Browser / Server) structure utilizes the increasingly mature web browser technology to realize powerful functions that originally required special software, saving development costs.
[0003] In the existing B / S structured system software, customers are paying more and more attention to page response efficiency. In addition to improving page response efficiency by optimizing request response time, cache optimization is also an important way to improve page response efficiency. In the process of optimizing client cache, more attention is paid to data caching, and the entire page structure and data are not cached after data acquisition and page structure rendering, which cannot meet the user's demand for rapid page access, resulting in poor user experience. Summary of the invention
[0004] The object of the present invention is to provide a page caching method, device and storage medium, which adopts a DOM structured page caching method in a client and can respond to user page requests more efficiently.
[0005] In order to achieve the above object, a first aspect of the present invention provides a page caching method, comprising:
[0006] Read the configuration file from the server, obtain the page information set including the page identifier, and cache it in the memory;
[0007] Obtain a page access request, identify a page identifier in the page access request, and compare the page identifier with the page identifier in the page information set;
[0008] According to the comparison result, the DOM structure and data of the corresponding page are extracted from the memory to complete the loading and display of the page in the client, or the DOM structure and data of the corresponding page are requested from the server and loaded and displayed after rendering in the client.
[0009] Preferably, before reading the configuration file from the server, obtaining the page information set including the page identifier and caching it in the memory, the following steps are also included:
[0010] The user account is logged in through the client, and after the server login verification is successful, the configuration file corresponding to the user account is fed back to the client.
[0011] Preferably, the configuration file includes page information of at least one page, wherein the page is a dynamic configuration page, a hotspot access page, and a dynamic cache page managed by a FIFO algorithm.
[0012] Preferably, the page information includes a menu root node, a page identifier, a DOM structure, an identifier of whether it belongs to a resident page cache, and page data.
[0013] Preferably, according to the comparison result, the DOM structure and data of the corresponding page are extracted from the memory to complete the loading and display of the page in the client, or the method of requesting the DOM structure and data of the corresponding page from the server and rendering and loading and displaying the page in the client includes:
[0014] When the comparison result is that there is no page identifier identical to that in the page access request in the page information set, a request is made from the server to obtain the DOM structure and data of the corresponding page, and the DOM structure and data are rendered in the client and loaded for display;
[0015] When the comparison result is that there is a page identifier in the page information set that is the same as that in the page access request, the page corresponding to the page access request is counted and updated, and the DOM structure and data of the page are extracted from the memory to complete the loading and display of the page in the client.
[0016] Preferably, the method for updating the count of the page corresponding to the page access request includes:
[0017] Each time a page access request occurs within a preset period, the number of visits to the corresponding page is accumulated once.
[0018] Furthermore, it also includes:
[0019] When the number of page visits exceeds a threshold within a period, the page is defined as a hotspot page, and the DOM structure and data of the page are cached in memory for a long time within the period by modifying the resident page cache identifier;
[0020] When the number of visits to the page within a period is lower than a threshold, the DOM structure and data of the page are cached in the memory according to the FIFO algorithm strategy within the period.
[0021] Preferably, it also includes:
[0022] The dynamic configuration page is a user-defined configuration page, and the dynamic configuration page is cached in the memory by uploading a configuration file;
[0023] A configuration file formed by one or more of the dynamic configuration page, the hotspot access page, and the dynamic cache page is synchronously updated in the server.
[0024] Compared with the prior art, the page caching method provided by the present invention has the following beneficial effects:
[0025] In the page caching method provided by the present invention, the client reads the configuration file corresponding to the user account from the server, obtains the page information set including the page identifier and caches it in the memory, then the client obtains the page access request, identifies the page identifier in the page access request and compares it with the page identifier in the page information set, when the comparison result is that there is no page identifier identical to that in the page access request in the page information set, then the DOM structure and data of the corresponding page are requested from the server and loaded and displayed after rendering in the client; when the comparison result is that there is a page identifier identical to that in the page access request in the page information set, then the page corresponding to the page access request is counted and updated, and the DOM structure and data of the page are extracted from the memory to complete the loading and display of the page in the client. It can be seen that since the DOM structure of the page is cached in the memory of the present invention, not just cached data, it can respond and present pages more quickly.
[0026] A second aspect of the present invention provides a page caching device, in which the page caching method described in the above technical solution is applied, the device comprising:
[0027] A configuration file reading unit, used to read the configuration file from the server, obtain a page information set including a page identifier, and cache the page information set in a memory;
[0028] An access request acquisition unit, used to acquire a page access request, identify a page identifier in the page access request, and compare it with the page identifier in the page information set;
[0029] The processing unit is used to extract the DOM structure and data of the corresponding page from the memory according to the comparison result and complete the loading and display of the page in the client, or to request the DOM structure and data of the corresponding page from the server and load and display it after rendering in the client.
[0030] Compared with the prior art, the beneficial effects of the page caching device provided by the present invention are the same as the beneficial effects of the page caching method provided by the above technical solution, which will not be elaborated here.
[0031] A third aspect of the present invention provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned page cache method are executed.
[0032] Compared with the prior art, the beneficial effects of the computer-readable storage medium provided by the present invention are the same as the beneficial effects of the page caching method provided by the above technical solution, which will not be elaborated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0034] Figure 1 A schematic diagram of a flow chart of a page caching method according to an embodiment of the present invention;
[0035] Figure 2 A schematic diagram of the data format of a configuration file in an embodiment of the present invention;
[0036] Figure 3 It is a structural block diagram of a page caching method in an embodiment of the present invention;
[0037] Figure 4 Schematic diagram of an electronic device in an embodiment of the present invention. DETAILED DESCRIPTION
[0038] In order to make the above-mentioned purposes, features and advantages of the present invention more obvious and easy to understand, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work belong to the scope of protection of the present invention.
[0039] Embodiment 1
[0040] See also Figure 1 , this embodiment provides a page caching method, including:
[0041] Read the configuration file from the server, obtain the page information set including the page identifier and cache it in the memory; obtain the page access request, identify the page identifier in the page access request and compare it with the page identifier in the page information set; extract the DOM structure (document object model) and data of the corresponding page from the memory according to the comparison result, complete the loading and display of the page in the client, or request the DOM structure and data of the corresponding page from the server, render it in the client, and then load and display it.
[0042] In the page caching method provided in this embodiment, the client reads the configuration file corresponding to the user account from the server, obtains the page information set including the page identifier and caches it in the memory, then the client obtains the page access request, identifies the page identifier in the page access request and compares it with the page identifier in the page information set, when the comparison result is that there is no page identifier identical to that in the page access request in the page information set, then the DOM structure and data of the corresponding page are requested from the server and loaded and displayed after rendering in the client; when the comparison result is that there is a page identifier identical to that in the page access request in the page information set, then the page corresponding to the page access request is counted and updated, and the DOM structure and data of the page are extracted from the memory to complete the loading and display of the page in the client. It can be seen that since the DOM structure of the page is cached in the memory of this embodiment, not just cached data, it can respond and present pages more quickly.
[0043] In the above embodiment, before reading the configuration file from the server, obtaining the page information set including the page identifier and caching it in the memory, the following steps are also included:
[0044] The user account is logged in through the client, and after the server login verification is successful, the configuration file corresponding to the user account is fed back to the client.
[0045] In specific implementation, the same user account can access the server through clients installed on different terminals. Therefore, when logging in to the user account through the client, the user's identity needs to be verified. There are various verification methods, such as password verification, biometric information verification, and security verification. Those skilled in the art can freely choose one or more of the above verification methods as needed, and this embodiment does not limit this. When the user identity verification is passed, the server will feedback the corresponding configuration file to the client that the user is using. The configuration file includes all the configuration information of the user's recent access to the web page.
[0046] Exemplarily, the page information of at least one page in the configuration file is a dynamic configuration page, a hotspot access page, and a dynamic cache page managed by a FIFO algorithm.
[0047] Exemplarily, the page information includes a menu root node, a page identifier, a DOM structure, an identifier of whether it belongs to a resident page cache, and page data.
[0048] In specific implementation, the pages cached in the memory are dynamically managed through configuration files. Dynamic configuration pages refer to pages that are customized by users. The specific implementation method is to build in an operation entry for uploading configuration files in the client. When users need to customize configuration pages, the method of uploading configuration files can be used to meet the dynamic caching needs of pages in different scenarios. Hot access pages refer to pages that users visit frequently. Dynamic cache pages refer to pages that users occasionally browse and visit, except for the above two situations.
[0049] The data format of the configuration file is JSON (object notation). The configuration format is as follows: Figure 2 As shown:
[0050] menus represents the root node of the current menu, which is a fixed value;
[0051] mid indicates the identifier of the specific menu to be configured, i.e. menuid. In a system, the route value of the menu is unique and is used as an identifier.
[0052] persist indicates whether the configured page DOM structure is permanently cached and will not be removed from the page cache as the user's hotspot access or page changes;
[0053] testBean represents the data corresponding to the cached page, and the specific subject or event information of the corresponding event change, which is used to update the data in the page cache DOM structure.
[0054] In the above embodiment, the method of extracting the DOM structure and data of the corresponding page from the memory according to the comparison result and completing the loading and display of the page in the client, or requesting the DOM structure and data of the corresponding page from the server and rendering and loading and displaying the page in the client includes:
[0055] When the comparison result is that there is no page identifier in the page information set that is the same as the page access request, the DOM structure and data of the corresponding page are requested from the server and then rendered in the client and loaded for display;
[0056] When the comparison result is that there is a page identifier in the page information set that is the same as that in the page access request, the count of the page corresponding to the page access request is updated, and the DOM structure and data of the page are extracted from the memory to complete the loading and display of the page in the client.
[0057] Exemplarily, the method for updating the count of the page corresponding to the page access request includes:
[0058] Each time a page access request occurs within a preset period, the number of visits to the corresponding page is accumulated once.
[0059] In specific implementation, when a user initiates a page access request through the client, the client will automatically identify the page identifier in the page access request and compare it with the page identifier in the page information set in the memory. When the comparison result hits, the DOM structure and data of the page are directly extracted from the memory and the page is loaded and displayed. At this time, the number of visits to the page needs to be recorded and updated to facilitate the subsequent caching strategy management of the page in the memory. When the comparison result cannot hit, it is necessary to request the DOM structure and data of the corresponding page from the server, render it in the client, and load and display it. The specific examples are as follows:
[0060] 1. When the user clicks the menu on the client to initiate a page access request, the routing information and page identifier corresponding to the page are first obtained;
[0061] 2. According to the page identifier, determine whether the DOM structure and data of the page have been cached in the memory. If they have been cached in the memory, directly return the DOM structure and data of the corresponding page. After the page obtains the DOM structure and data, directly load the DOM structure and data, and then directly present it on the client, and the page access request process ends;
[0062] 3. If the requested page is not cached in memory, a page access request is sent to the server. The server responds to the request. After receiving the request, the client loads the page data and renders the page. Then, the page cache management strategy is implemented. The following operations are mainly completed:
[0063] Determine whether the page ID of the access request exists in the page information set. If so, directly store the rendered DOM structure and data in the memory cache, and the request process ends; if the page ID of the access request does not exist in the page ID set, first update the request counter data, so that the data in the request counter is increased by 1;
[0064] Compare the access count of the request counter with the set threshold. If it is less than the set threshold, the request result is returned and the process ends.
[0065] If the request counter value is greater than the set request threshold, the page DOM structure and data need to be stored in memory. The cache management algorithm is described as follows:
[0066] Determine whether the page access count has reached the set maximum cache count. If it has not reached the maximum number allowed for caching, directly put the requested DOM structure and data into the memory, and the process ends;
[0067] If the number of cached pages has reached the maximum number allowed, a cached data needs to be removed. At this time, according to the FIFO algorithm, the page cache replacement strategy is completed and the process ends.
[0068] In the above embodiment, it also includes: when the number of page visits within a cycle exceeds a threshold, the page is defined as a hot access page, and the DOM structure and data of the page are cached in the memory for a long time within the cycle by modifying the resident page cache identifier; when the number of page visits within the cycle is lower than the threshold, the DOM structure and data of the page are cached in the memory according to the FIFO algorithm strategy within the cycle.
[0069] In specific implementation, the difference between hot access pages and dynamic cache pages lies in the number of times they are accessed within a cycle. When the number of times a dynamic cache page is accessed within a cycle exceeds a threshold, it is marked as a hot access page. Conversely, when the number of times a hot access page is accessed within a cycle is lower than a threshold, it is marked as a dynamic cache page. That is, hot access pages and dynamic cache pages change dynamically.
[0070] The above embodiment also includes: the dynamic configuration page is a user-defined configuration page, and the dynamic configuration page is cached in the memory by uploading the configuration file; the configuration file formed by one or more of the dynamic configuration page, hotspot access page, and dynamic cache page is synchronously updated in the server.
[0071] In specific implementation, one or more of the dynamic configuration page, hotspot access page, and dynamic cache page in the memory are synchronized with the configuration file to meet the consistency synchronization of the cache page in the memory when the user logs in from different clients. Of course, it is also possible to set only the configuration file synchronization of the hotspot access page or the dynamic configuration page. This embodiment only uses the configuration file synchronization of the dynamic configuration page as an example:
[0072] A configuration file operation entry is set on the client. When the user needs to customize the cache page, the content of the original configuration file can be overwritten by uploading the configuration file, thereby satisfying the dynamic customization of page cache in different scenarios. When the user customizes the cache page and uploads the configuration file, he can specify whether to synchronize the configuration file data with the hotspot access page in the current memory in real time, so as to complete the real-time synchronization of the hotspot page with the page in the configuration file and complete the synchronous update of the cache item.
[0073] Optionally, the pages cached in the memory of this embodiment can also set a cache expiration time, and monitor from the time they are initially added to the memory. If the existence time is greater than the cache expiration time, they will be removed from the memory. This not only ensures the validity of the cached pages, but also releases the occupied memory space in a timely manner, and then releases the relatively seldom used "fake dead" pages in the memory in a timely manner, making the client run more efficient and smoother.
[0074] In summary, the DOM structure is cached in the memory of this embodiment, so it can respond and present pages more quickly. Secondly, it supports the caching of dynamically configured pages in different scenarios, and supports the synchronous update function of dynamically configured pages and hotspot access pages. In addition, it also supports real-time identification and dynamic replacement of hotspot access pages to ensure that the pages cached in the memory are user-defined and frequently accessed pages, and by setting the cache expiration time, the validity of the cached data can be guaranteed. The DOM element structure corresponding to each page is fixed. The use of the cache requires monitoring of operational events (addition, modification and deletion operations) in the entire system. When there are event changes, the data in the DOM structure in the page cache will also change synchronously to ensure the consistency and real-time nature of the cached data, and dynamically and flexibly implement page caching in a decoupled and independent manner, which speeds up the response time when the page is accessed and improves the user experience.
[0075] Embodiment 2
[0076] See also Figure 3 , this embodiment provides a page cache device, including:
[0077] A configuration file reading unit, used to read the configuration file from the server, obtain a page information set including a page identifier, and cache the page information set in a memory;
[0078] An access request acquisition unit, used to acquire a page access request, identify a page identifier in the page access request, and compare it with the page identifier in the page information set;
[0079] The processing unit is used to extract the DOM structure and data of the corresponding page from the memory according to the comparison result and complete the loading and display of the page in the client, or to request the DOM structure and data of the corresponding page from the server and load and display it after rendering in the client.
[0080] Compared with the prior art, the beneficial effects of the page caching device provided in the embodiment of the present invention are the same as the beneficial effects of the page caching method provided in the above-mentioned embodiment 1, and are not described in detail here.
[0081] Embodiment 3
[0082] This embodiment provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned page cache method are executed.
[0083] The computer-readable storage medium provided in this embodiment can be, for example, - but not limited to - an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, system or device, or any combination of the above. More specific examples of computer-readable storage media can include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, system or device. The program code contained on the computer-readable storage medium can be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
[0084] The computer-readable storage medium may be included in the electronic device, or may exist independently without being installed in the electronic device.
[0085] The computer-readable storage medium carries one or more programs. When the one or more programs are executed by an electronic device, the electronic device: obtains at least two Internet Protocol addresses; sends a node evaluation request including the at least two Internet Protocol addresses to a node evaluation device, wherein the node evaluation device selects an Internet Protocol address from the at least two Internet Protocol addresses and returns it; receives the Internet Protocol address returned by the node evaluation device; wherein the obtained Internet Protocol address indicates an edge node in a content distribution network.
[0086] Alternatively, the computer-readable storage medium carries one or more programs, and when the one or more programs are executed by an electronic device, the electronic device: receives a node evaluation request including at least two Internet Protocol addresses; selects an Internet Protocol address from the at least two Internet Protocol addresses; and returns the selected Internet Protocol address; wherein the received Internet Protocol address indicates an edge node in a content distribution network.
[0087] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages, or a combination thereof, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).
[0088] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0089] The modules involved in the embodiments described in the present disclosure may be implemented by software or hardware, wherein the name of the module does not limit the unit itself in some cases.
[0090] The computer-readable storage medium provided in this embodiment stores computer-readable program instructions for executing the data configuration recommendation method of the above-mentioned hierarchical storage management software, and can realize the optimal recommendation of configuration data according to the data processing status of multiple storage layers of the storage device when the user logs into the storage management software. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in the embodiment of the present invention are the same as the beneficial effects of the page cache method provided in the above-mentioned embodiment 1 or embodiment 2, and will not be repeated here.
[0091] Embodiment 4
[0092] An embodiment of the present invention provides an electronic device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the page caching method in the above-mentioned embodiment 1.
[0093] Reference below Figure 4 , which shows a schematic diagram of the structure of an electronic device suitable for implementing the embodiments of the present disclosure. The electronic device in the embodiments of the present disclosure may include, but is not limited to, mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 4 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0094] like Figure 4 As shown, the electronic device may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) or a program loaded from a storage device into a random access memory (RAM). In the RAM, various programs and data required for the operation of the electronic device are also stored. The processing device, ROM, and RAM are connected to each other via a bus. An input / output (I / O) interface is also connected to the bus.
[0095] Typically, the following systems can be connected to the I / O interface: input devices including, for example, a touch screen, a touchpad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; output devices including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; storage devices including, for example, a magnetic tape, a hard disk, etc.; and communication devices. The communication device can allow the electronic device to communicate with other devices wirelessly or by wire to exchange data. Although the figure shows an electronic device with various systems, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems may be implemented or have alternatively.
[0096] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device, or installed from a ROM. When the computer program is executed by a processing device, the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.
[0097] The electronic device provided by the present invention adopts the page caching method of the hierarchical storage management software in the above-mentioned embodiment 1 or embodiment 2, and can respond to the user's page request more efficiently by adopting the page caching method of the DOM structure in the client. Compared with the prior art, the beneficial effects of the electronic device provided by the embodiment of the present invention are the same as the beneficial effects of the page caching method provided by the above-mentioned embodiment 1, and other technical features in the electronic device are the same as the features disclosed in the method of the previous embodiment, which will not be repeated here.
[0098] It should be understood that the various parts of the present disclosure can be implemented with hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.
[0099] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.
Claims
1. A page caching method, characterized in that: include: Read the configuration file from the server, obtain the page information set including the page identifier, and cache it in the memory; Obtain a page access request, identify a page identifier in the page access request, and compare the page identifier with the page identifier in the page information set; According to the comparison result, the DOM structure and data of the corresponding page are extracted from the memory and the page is loaded and displayed in the client, or the DOM structure and data of the corresponding page are requested from the server and loaded and displayed after rendering in the client; If the page identifier of the access request does not exist in the page information set, the request counter data is updated so that the data in the request counter is increased by 1; Compare the access count of the request counter with the set request threshold; if the request counter value is greater than the set request threshold, store the DOM structure and data of the page in memory; Read the configuration file from the server, obtain the page information set including the page identifier and cache it in the memory, and also include: Log in to the user account through the client, and after the server login verification is successful, feedback the configuration file corresponding to the user account to the client; The configuration file includes page information of at least one page, wherein the page is a dynamic configuration page, a hotspot access page, and a dynamic cache page managed by a FIFO algorithm; The page information includes menu root node, page identifier, DOM structure, whether it belongs to the resident page cache identifier and page data; The method of extracting the DOM structure and data of the corresponding page from the memory according to the comparison result and completing the loading and display of the page in the client, or requesting the DOM structure and data of the corresponding page from the server and rendering and loading and displaying the page in the client includes: When the comparison result is that there is no page identifier identical to the page access request in the page information set, the DOM structure and data of the corresponding page are requested from the server and loaded and displayed after being rendered on the client; When the comparison result is that there is a page identifier identical to the page access request in the page information set, the page corresponding to the page access request is counted and updated, and the DOM structure and data of the page are extracted from the memory to complete the loading and display of the page on the client; The method for updating the count of the page corresponding to the page access request includes: Every time a page access request occurs within a preset period, the number of visits to the corresponding page is accumulated once; When the number of page visits exceeds a threshold within a period, the page is defined as a hotspot page, and the DOM structure and data of the page are cached in memory for a long time within the period by modifying the resident page cache identifier; When the number of visits to the page within a period is lower than a threshold, the DOM structure and data of the page are cached in the memory according to the FIFO algorithm strategy within the period; The dynamic configuration page is a user-defined configuration page, and the dynamic configuration page is cached in the memory by uploading a configuration file; A configuration file formed by one or more of the dynamic configuration page, the hotspot access page, and the dynamic cache page is synchronously updated in the server; When the number of visits to a dynamic cache page exceeds a threshold within a cycle, it is marked as a hotspot access page. When the number of visits to a hotspot access page within a cycle is lower than a threshold, it is marked as a dynamic cache page. The hotspot access page and the dynamic cache page can change dynamically.
2. A page cache device for implementing the page cache method of claim 1, characterized in that: include: A configuration file reading unit, used to read the configuration file from the server, obtain a page information set including a page identifier, and cache the page information set in a memory; An access request acquisition unit, used to acquire a page access request, identify a page identifier in the page access request, and compare it with the page identifier in the page information set; A processing unit is used to extract the DOM structure and data of the corresponding page from the memory according to the comparison result and complete the loading and display of the page in the client, or to request the DOM structure and data of the corresponding page from the server and load and display it after rendering in the client; If the page identifier of the access request does not exist in the page information set, the request counter data is updated so that the data in the request counter is increased by 1; The access count of the request counter is compared with the set request threshold; if the request counter value is greater than the set request threshold, the DOM structure and data of the page are stored in the memory.
3. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to claim 1 are executed.
