Page caching method and device, equipment and storage medium

By only the required pages are cached when page caching, and using the matching mechanism of preset cache list and page access paths, the problem of large space and poor performance of page cache in the existing technology is solved, and more efficient cache management is achieved.

CN119441644APending Publication Date: 2025-02-14BEIJING HONGTENG INTELLIGENT TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310962883.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-08-01
Publication Date
2025-02-14

AI Technical Summary

Technical Problem

The prior art takes up a lot of space and poor performance when page caching, and requires setting up a large number of listening methods to realize the update of cached pages.

Method used

By detecting the page root path and page access path when accessing the website page, find the set of pending web pages corresponding to the page root path in the preset cache list, and cache only when the page access path exists in the set of pending web pages, reducing the need for not Necessary cache and listening.

Benefits of technology

It effectively reduces the space usage during page caching, simplifies the update process of cached pages, and improves the performance of page caching.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119441644A_ABST
    Figure CN119441644A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of computers, and discloses a page caching method and device, equipment and a storage medium. The method comprises the steps of obtaining a page root path and a page access path corresponding to a website page when it is detected that the website page is accessed; searching a to-be-stored webpage set corresponding to the page root path in a preset cache list; and if the page access path exists in the to-be-stored webpage set, caching the website page. The page root path and the page access path of the website page can be obtained during page caching, and the website page is cached only when the page access path exists in the to-be-stored webpage set corresponding to the page root path, so that all webpages do not need to be cached, and only part of the webpages needing to be cached are cached; according to the page caching method and device, the occupied space during page caching is reduced, due to the fact that the cached pages are reduced, updating of the cached pages is simpler, too many monitoring methods do not need to be set, and therefore the page caching performance is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a page cache method, device, equipment and storage medium. Background Art

[0002] When browsing web information, you often need to switch back and forth. Each time you switch pages, the page will be refreshed, resulting in the loss of information filled in the page and a poor user experience. In order to solve this defect, the current solution is to add a cache, store all the pages opened by the user through the cache, and add an independent listening method to the page to update the page. The overall cache occupies a large space, and in order to realize the update of the cached page, there are many listening methods, which will cause a lot of performance waste.

[0003] The above contents are only used to assist in understanding the technical solution of the present invention and do not constitute an admission that the above contents are prior art. Summary of the invention

[0004] The main purpose of the present invention is to provide a page caching method, device, equipment and storage medium, aiming to solve the technical problems of large space occupation and poor performance in the prior art page caching.

[0005] To achieve the above object, the present invention provides a page caching method, which comprises the following steps:

[0006] When detecting that a website page is accessed, obtaining the page root path and page access path corresponding to the website page;

[0007] Searching for a set of web pages to be stored corresponding to the page root path in a preset cache list;

[0008] If the page access path exists in the set of web pages to be stored, the website page is cached.

[0009] Optionally, the step of searching the preset cache list for a set of web pages to be stored corresponding to the page root path includes:

[0010] Get the history cache root path;

[0011] Compare the historical cache root path with the page root path;

[0012] If the historical cache root path is consistent with the page root path, the to-be-stored web page set corresponding to the page root path is searched in the preset cache list.

[0013] Optionally, if the historical cache root path is consistent with the page root path, the step of searching a preset cache list for a set of web pages to be stored corresponding to the page root path includes:

[0014] If the historical cache root path is consistent with the page root path, obtaining a web page cache set;

[0015] Detecting whether there is a cache page corresponding to the page access path in the web page cache set;

[0016] If it does not exist, then search the preset cache list for the to-be-stored web page set corresponding to the page root path.

[0017] Optionally, the step of detecting whether there is a cache page corresponding to the page access path in the web page cache set includes:

[0018] Obtaining a website access link corresponding to the website page;

[0019] Extracting access link parameters from the website access link;

[0020] It is detected whether there is a cache page corresponding to the page access path and the access link parameter in the web page cache set.

[0021] Optionally, the step of detecting whether a cache page corresponding to the page access path and the access link parameter exists in the web page cache set includes:

[0022] Generate a cache set index according to the page access path and the access link parameters;

[0023] Detect whether there is a cache page corresponding to the cache set index in the web page cache set.

[0024] Optionally, after the step of detecting whether there is a cache page corresponding to the page access path in the web page cache set, the step further includes:

[0025] If so, extracting the cached page from the web page cache set;

[0026] The page is displayed according to the cached page.

[0027] Optionally, after the step of comparing the historical page root path with the page root path, the method further includes:

[0028] If the historical cache root path is inconsistent with the page root path, clear the web page cache set;

[0029] When the clearing is completed, the set of web pages to be stored corresponding to the page root path is searched in the preset cache list.

[0030] Optionally, if the page access path exists in the set of web pages to be stored, the step of caching the website page includes:

[0031] If the page access path exists in the to-be-stored web page set, the website page is stored in the web page cache set based on the page access path.

[0032] Optionally, if the page access path exists in the to-be-stored web page set, the step of storing the website page in the web page cache set based on the page access path includes:

[0033] If the page access path exists in the set of web pages to be stored, obtaining a website access link corresponding to the website page;

[0034] Extracting access link parameters from the website access link;

[0035] The website page is stored in a web page cache collection based on the page access path and the access link parameter.

[0036] Optionally, the step of storing the website page in a web page cache set based on the page access path and the access link parameter includes:

[0037] Combining the page access path and the access link parameter to generate a cache set index;

[0038] A key-value pair is constructed according to the cache set index and the website page, and the constructed key-value pair is stored in the web page cache set.

[0039] Optionally, before the step of obtaining the page root path and page access path corresponding to the website page when detecting that the website page is accessed, the step further includes:

[0040] Monitor the browser address bar in real time;

[0041] If it is monitored that the user enters a website access link in the address bar and confirms it, it is determined that the access to the website page is detected.

[0042] In addition, to achieve the above object, the present invention also provides a page cache device, which includes the following modules:

[0043] A data acquisition module, used to acquire the page root path and page access path corresponding to the website page when detecting access to the website page;

[0044] A data search module, used to search for a set of web pages to be stored corresponding to the page root path in a preset cache list;

[0045] The page cache module is used to cache the website page if the page access path exists in the set of web pages to be stored.

[0046] Optionally, the data search module is further used to obtain a historical cache root path; compare the historical cache root path with the page root path; if the historical cache root path is consistent with the page root path, search for a set of to-be-stored web pages corresponding to the page root path in a preset cache list.

[0047] Optionally, the data search module is also used to obtain a web page cache set if the historical cache root path is consistent with the page root path; detect whether there is a cache page corresponding to the page access path in the web page cache set; if not, search for a to-be-stored web page set corresponding to the page root path in a preset cache list.

[0048] Optionally, the data search module is also used to obtain the website access link corresponding to the website page; extract the access link parameter from the website access link; and detect whether there is a cache page corresponding to the page access path and the access link parameter in the web page cache collection.

[0049] Optionally, the data search module is further used to generate a cache set index according to the page access path and the access link parameter; and detect whether there is a cache page corresponding to the cache set index in the web page cache set.

[0050] Optionally, the data search module is further configured to extract the cache page from the web page cache set if it exists; and perform page display based on the cache page.

[0051] Optionally, the data search module is further used to clear the web page cache set if the historical cache root path is inconsistent with the page root path; when the clearing is completed, search the preset cache list for the to-be-stored web page set corresponding to the page root path.

[0052] In addition, to achieve the above-mentioned purpose, the present invention also proposes a page cache device, which includes: a processor, a memory, and a page cache program stored in the memory and executable on the processor, and the page cache program implements the steps of the page cache method described above when executed by the processor.

[0053] In addition, to achieve the above-mentioned purpose, the present invention further proposes a computer-readable storage medium, on which a page cache program is stored, and when the page cache program is executed, the steps of the page cache method described above are implemented.

[0054] The present invention obtains the page root path and page access path corresponding to the website page when detecting the access to the website page; searches for the to-be-stored web page set corresponding to the page root path in the preset cache list; and caches the website page if the page access path exists in the to-be-stored web page set. Since the page root path and page access path of the website page are obtained when caching the page, the website page is cached only when the page access path exists in the to-be-stored web page set corresponding to the page root path, so that it is not necessary to cache all web pages, but only cache some web pages that need to be cached, which reduces the space occupied when caching the page, and due to the reduction of cached pages, the update of the cached page is also simpler, and there is no need to set too many monitoring methods, thereby improving the performance of the page cache. BRIEF DESCRIPTION OF THE DRAWINGS

[0055] Figure 1 It is a schematic diagram of the structure of an electronic device in a hardware operating environment involved in an embodiment of the present invention;

[0056] Figure 2 This is a flow chart of a first embodiment of a page caching method according to the present invention;

[0057] Figure 3 A schematic diagram of a flow chart of a second embodiment of a page caching method of the present invention;

[0058] Figure 4 A schematic diagram of a flow chart of a third embodiment of a page caching method of the present invention;

[0059] Figure 5 A schematic diagram of a flow chart of a fourth embodiment of a page caching method according to the present invention;

[0060] Figure 6 A schematic diagram of a page cache process according to an embodiment of the present invention;

[0061] Figure 7 It is a structural block diagram of the first embodiment of the page cache device of the present invention.

[0062] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0063] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.

[0064] Reference Figure 1 , Figure 1 The schematic diagram is a page cache device structure diagram of a hardware operating environment involved in an embodiment of the present invention.

[0065] like Figure 1As shown, the electronic device may include: a processor 1001, such as a central processing unit (CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), an input unit such as a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a wireless fidelity (WIreless-FIdelity, WI-FI) interface). The memory 1005 may be a high-speed random access memory (Random Access Memory, RAM), or a stable non-volatile memory (Non-Volatile Memory, NVM), such as a disk storage. The memory 1005 may also be a storage device independent of the aforementioned processor 1001.

[0066] Those skilled in the art will understand that Figure 1 The structure shown in the figure does not constitute a limitation on the electronic device, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.

[0067] like Figure 1 As shown, the memory 1005 as a storage medium may include an operating system, a network communication module, a user interface module, and a page cache program.

[0068] exist Figure 1 In the electronic device shown, the network interface 1004 is mainly used for data communication with a network server; the user interface 1003 is mainly used for data interaction with a user; the processor 1001 and the memory 1005 in the electronic device of the present invention can be set in a page cache device, and the electronic device calls the page cache program stored in the memory 1005 through the processor 1001, and executes the page cache method provided in an embodiment of the present invention.

[0069] The embodiment of the present invention provides a page caching method, referring to Figure 2 , Figure 2 The figure is a flow chart of a first embodiment of a page caching method according to the present invention.

[0070] In this embodiment, the page caching method includes the following steps:

[0071] Step S10: when detecting access to a website page, obtaining a page root path and a page access path corresponding to the website page.

[0072] It should be noted that the executor of this embodiment can be the page cache device, and the page cache device can be an electronic device such as a personal computer or a server. Of course, it can also be other devices that can achieve the same or similar functions. This embodiment does not limit this. In this embodiment and the following embodiments, the page cache method of the present invention is explained by taking the page cache device as an example.

[0073] It should be noted that if access to a website page is detected, it means that the user wants to browse the website page. At this time, in order to determine whether the website page needs to be cached, the page root path and page access path corresponding to the website page can be obtained.

[0074] Wherein, obtaining the page root path and the page access path corresponding to the website page may be obtaining the page access link corresponding to the website page, and extracting the page root path and the page access path from the page access link.

[0075] For example: assuming that the web page access link of the website page is "www.A.COM / pageA / a / s?Id=1", then the page root path is " / pageA", the page access path is " / pageA / a / s", and the access link parameter is "Id=1".

[0076] In a specific implementation, since the user accesses a website page, he needs to enter the website link in the address bar of the browser and click to confirm the access. At this time, before step S10 in this embodiment, the following may be included:

[0077] Monitor the browser address bar in real time;

[0078] If it is monitored that the user enters a website access link in the address bar and confirms it, it is determined that the access to the website page is detected.

[0079] It is understandable that if the user is monitored to enter a website access link in the address bar and confirm it, it means that the user has manually entered the link and clicked the Enter button or the OK button. At this time, it can be determined that the user wants to browse the website page, so it can be determined that the website page access is detected.

[0080] Step S20: searching a preset cache list for a set of web pages to be stored that corresponds to the page root path.

[0081] It should be noted that, in order to reduce the web pages that need to be cached, the administrator of the page cache device can pre-set a collection of web pages to be stored, which is used to store the page access paths of the web pages that need to be cached. Different page root paths can correspond to different collections of web pages to be stored.

[0082] In a specific implementation, the preset cache list can be stored in the global memory of the browser, such as in vuex, where the page root path is used as an index to store multiple collections of web pages to be stored.

[0083] For example, assuming that the preset cache list is: {pageA:[pageA / a],pageB:[pageB / b,pageB / c]}, then the preset cache list stores the to-be-stored web page sets corresponding to the two page root paths of "pageA" and "pageB".

[0084] Step S30: If the page access path exists in the set of web pages to be stored, the website page is cached.

[0085] It should be noted that if the page access path exists in the set of web pages to be stored, it means that the website page is a web page that is designated to be cached, so the website page can be cached.

[0086] In a specific implementation, caching a website page may be adding the website page to a web page cache collection, wherein the web page cache collection may be a collection of data stored in a key-value pair manner in a memory of a page cache device, such as a map collection.

[0087] This embodiment obtains the page root path and page access path corresponding to the website page when detecting the access to the website page; searches for the to-be-stored web page set corresponding to the page root path in the preset cache list; if the page access path exists in the to-be-stored web page set, the website page is cached. Since the page root path and page access path of the website page are obtained when caching the page, the website page is cached only when the page access path exists in the to-be-stored web page set corresponding to the page root path, so that it is not necessary to cache all web pages, but only cache some web pages that need to be cached, which reduces the space occupied by page caching, and due to the reduction of cached pages, the update of cached pages is also simpler, and there is no need to set too many monitoring methods, thereby improving the performance of page caching.

[0088] refer to Figure 3 , Figure 3 The figure is a flow chart of a second embodiment of a page caching method according to the present invention.

[0089] Based on the first embodiment, step S20 of the page caching method of this embodiment includes:

[0090] Step S201: Obtain the historical cache root path.

[0091] It should be noted that the historical cache root path may be the page root path of the website page that was cached when the website page was previously accessed.

[0092] In the specific implementation, the historical cache root path can be obtained by using the corresponding framework tools or framework function modules. For example, through the global listening beforeEach function of vue-router, the previously visited website access link is obtained, and then the page root path is extracted from the website access link to obtain the historical cache root path.

[0093] Step S202: Compare the historical cache root path with the page root path.

[0094] It should be noted that in order to reduce the pressure on the cache, when the website page visited by the user undergoes a major change (such as switching to visit a website page under another page root path), the previously cached page can be cleared, thereby reducing the resources occupied when caching the website page. Therefore, the historical cache root path can be compared with the page root path to determine whether the cached website page needs to be cleared.

[0095] Step S203: If the historical cache root path is consistent with the page root path, then searching a preset cache list for a set of web pages to be stored that corresponds to the page root path.

[0096] It can be understood that if the historical cache root path is consistent with the page root path, it means that the website page visited by the user has not changed significantly, and is still accessing the website page under the same page root path. At this time, in order to ensure that the cached pages can be used to improve the access efficiency of users to the website pages, the previously cached pages can be temporarily not cleared. In order to determine whether the website page visited at this time needs to be cached, the set of to-be-stored web pages corresponding to the page root path can be searched in the preset cache list.

[0097] In a specific implementation, in order to reduce the resources occupied when caching website pages, after step S202 in this embodiment, the following may also be included:

[0098] If the historical cache root path is inconsistent with the page root path, clear the web page cache set;

[0099] When the clearing is completed, the set of web pages to be stored corresponding to the page root path is searched in the preset cache list.

[0100] It should be noted that if the historical cache root path is inconsistent with the page root path, it means that the website page the user is visiting has undergone significant changes from the website page visited before and is no longer under the same page root path. The difference between website pages under different page root paths is generally large. At this time, the previously cached website page may not be able to improve the access efficiency of the user to the website page. Therefore, the web page cache collection previously used to store cached website pages can be cleared. After the clearing is completed, it is determined whether the currently visited website page needs to be cached. Therefore, the to-be-stored web page collection corresponding to the page root path can be searched in the preset cache list.

[0101] For example: assuming that the preset cache list is {pageA: [pageA, pageA / a]}, the user enters page pageA at this time, and its page root path is pageA. At this time, the historical cache root path can be obtained. If the historical cache root path is pageB, the web page cache collection can be cleared at this time, and then the to-be-stored web page collection [pageA, pageA / a] can be obtained. At this time, pageA is in the to-be-stored web page collection, and page pageA can be cached; if the historical cache root path is pageA, there is no need to clear the web page cache collection at this time, and the to-be-stored web page collection [pageA, pageA / a] can be directly obtained. At this time, pageA is in the to-be-stored web page collection, and page pageA needs to be cached.

[0102] This embodiment obtains a historical cache root path; compares the historical cache root path with the page root path; if the historical cache root path is consistent with the page root path, searches for a to-be-stored web page set corresponding to the page root path in a preset cache list. 由于会将 The historical cache root path is compared with the page root path of the currently visited web page. When the historical cache root path is inconsistent with the page root path, the web page cache collection is cleared to remove cache pages that are invalid for improving the efficiency of the current web page access, further reducing the space occupied by the page cache.

[0103] refer to Figure 4 , Figure 4 It is a flow chart of a third embodiment of a page caching method of the present invention.

[0104] Based on the above second embodiment, step S203 of the page caching method of this embodiment includes:

[0105] Step S2031: If the historical cache root path is consistent with the page root path, a web page cache set is obtained.

[0106] It should be noted that if the historical cache root path is consistent with the page root path, it means that the website page visited by the user has not changed significantly, and is still accessing the website page under the same page root path. At this time, the cached page can be used to improve the access efficiency of the user to the website page. Therefore, a web page cache collection can be obtained.

[0107] Step S2032: Detect whether there is a cache page corresponding to the page access path in the web page cache set.

[0108] It should be noted that the web page cache set may be a set storing data in a key-value pair format, wherein the key of the key-value pair is the page access path of the cached website page, and the value is the cached website page.

[0109] In a specific implementation, detecting whether there is a cache page corresponding to the page access path in the web page cache collection can be to detect whether there is a key-value pair in the web page cache collection whose key is consistent with the page access path. If there is a key-value pair that is consistent with the page access path, it is determined that there is a cache page corresponding to the page access path in the web page cache collection; if there is no key-value pair that is consistent with the page access path, it is determined that there is no cache page corresponding to the page access path in the web page cache collection.

[0110] In a specific implementation, even if the website pages corresponding to the same page access path may actually have different specific contents (such as product detail pages, different products may share the same template page, in which case the page access paths of a batch of product detail pages will be the same). In order to cope with such a situation and avoid page display errors, step S2032 in this embodiment may include:

[0111] Extracting access link parameters from the website access link;

[0112] It is detected whether there is a cache page corresponding to the page access path and the access link parameter in the web page cache set.

[0113] It should be noted that in order to avoid errors in placing orders for goods, the provider of the website pages will distinguish between the website pages. Even if the same page access path corresponds to website pages with different contents, the access link parameters for accessing the website pages will also be different. In this case, when detecting whether there is a cached page in the web page cache collection, the access link parameters can be first extracted from the website access link, and then the web page cache collection can be detected whether there is a cached page corresponding to the page access path and the access link parameters.

[0114] It is understandable that when detecting whether there is a cached page, adding the access link parameter for joint detection can effectively distinguish pages such as product details pages, and avoid page display errors caused by errors in obtaining cached pages.

[0115] In a specific implementation, since the web page cache set may be a set storing data in the form of key-value pairs, the step of detecting whether there is a cache page corresponding to the page access path and the access link parameter in the web page cache set may include:

[0116] Generate a cache set index according to the page access path and the access link parameters;

[0117] Detect whether there is a cache page corresponding to the cache set index in the web page cache set.

[0118] It should be noted that generating the cache set index according to the page access path and the access link parameters may be concatenating the page access path and the access link parameters in a preset format, and then using the concatenated data as the cache set index.

[0119] The preset format may be pre-set by the administrator of the page cache device, for example, the preset format may be set to "page access path? access link parameters", where "?" is a concatenation connector and may be adjusted by the administrator of the page cache device according to actual needs.

[0120] In a specific implementation, detecting whether there is a cache page corresponding to a cache set index in a web page cache set can be detecting whether there is a key-value pair in the web page cache set whose key is consistent with the cache set index. If so, it is determined that there is a cache page corresponding to the cache set index in the web page cache set; if not, it is determined that there is no cache page corresponding to the cache set index in the web page cache set.

[0121] Step S2033: If it does not exist, search the preset cache list for the to-be-stored web page set corresponding to the page root path.

[0122] It is understandable that if there is no cache page corresponding to the page access path in the web page cache collection, it means that the currently visited website page has not been cached before. At this time, it is also necessary to detect whether the currently visited website page needs to be cached. Therefore, the to-be-stored web page collection corresponding to the page root path can be searched in the preset cache list.

[0123] In a specific implementation, in order to improve the access efficiency of users to website pages, after step S2032 in this embodiment, the following may also be included:

[0124] If so, extracting the cached page from the web page cache set;

[0125] The page is displayed according to the cached page.

[0126] It can be understood that if there is a cache page corresponding to the page access path in the web page cache collection, it means that the website page currently visited by the user has been cached. At this time, you no longer need to access the website server to request the website page, but directly extract the cache page corresponding to the page access path from the web page cache collection, and then display the page based on the cache page, thereby reducing the communication interaction process with the website server and improving access efficiency.

[0127] In this embodiment, if the historical cache root path is consistent with the page root path, a web page cache set is obtained; if there is a cache page corresponding to the page access path in the web page cache set, it is detected; if not, a to-be-stored web page set corresponding to the page root path is searched in a preset cache list. Since the historical cache root path and the page root path are used to detect whether there is a cache page corresponding to the page access path in the web page cache set, it is determined whether the currently visited website page has been pre-cached. If not, it is further determined whether it needs to be cached; if it has been pre-cached, the page will be displayed directly based on the cached page, reducing unnecessary communication interactions with the website server and improving the access efficiency of page access.

[0128] refer to Figure 5 , Figure 5 It is a flowchart diagram of a fourth embodiment of a page caching method of the present invention.

[0129] Based on the first embodiment, step S30 of the page caching method of this embodiment includes:

[0130] Step S30': if the page access path exists in the to-be-stored web page set, the website page is stored in the web page cache set based on the page access path.

[0131] It should be noted that if the page access path exists in the to-be-stored web page set, it means that the currently visited website page is a page that needs to be cached. Therefore, the website page can be stored in the web page cache set based on the page access path.

[0132] In a specific implementation, storing website pages in a web page cache collection based on page access paths may be to construct a key-value pair using the page access path as a key and the website page as a value, and then add the constructed key-value pair to the web page cache collection.

[0133] Furthermore, since the website pages corresponding to the same page access path may actually have different specific contents (e.g., product detail pages, different products may share the same template page, in which case a batch of product detail pages have the same page access path), in order to ensure that such pages can be distinguished when caching pages, step S30′ in this embodiment may include:

[0134] If the page access path exists in the set of web pages to be stored, obtaining a website access link corresponding to the website page;

[0135] Extracting access link parameters from the website access link;

[0136] The website page is stored in a web page cache collection based on the page access path and the access link parameter.

[0137] It should be noted that in order to avoid errors in placing orders for goods, the provider of the website pages will distinguish the website pages. Even if the same page access path can correspond to website pages with different contents, the access link parameters for accessing the website page will be different. Therefore, when caching website pages, in order to ensure that website pages with the same page access path but different contents can be distinguished, the website access link corresponding to the website page can be obtained, and then the access link parameters can be extracted from the website access link. The website page can then be stored in a web page cache collection based on the page access path and the access link parameters, thereby ensuring that website pages with different contents but the same page access path can be distinguished in the web page cache collection.

[0138] In a specific implementation, since the web page cache set may be a set that stores data in a key-value pair format, and the key of such a set is unique, when the website page is stored in the web page cache set based on the page access path and the access link parameter, it is necessary to ensure that the key during storage is different. In this case, the step of storing the website page in the web page cache set based on the page access path and the access link parameter in this embodiment may include:

[0139] Combining the page access path and the access link parameter to generate a cache set index;

[0140] A key-value pair is constructed according to the cache set index and the website page, and the constructed key-value pair is stored in the web page cache set.

[0141] It should be noted that combining the page access path and the access link parameters to generate the cache set index may be combining and splicing the page access path and the access link parameters in a preset format, and then using the spliced ​​data as the cache set index.

[0142] The preset format may be pre-set by the administrator of the page cache device, for example, the preset format may be set to "page access path? access link parameters", where "?" is a concatenation connector and may be adjusted by the administrator of the page cache device according to actual needs.

[0143] In a specific implementation, constructing a key-value pair according to the cache collection index and the website page may be to construct the key-value pair using the cache collection index as the key and the website page as the value.

[0144] For ease of understanding, now combined Figure 6 This is for illustration but not for limitation. Figure 6 FIG. 1 is a schematic diagram of the page cache process of this embodiment. Figure 6 As shown, a cache mapping relationship table between pages (i.e., the above-mentioned preset cache list) can be preset. At this time, two pages pageA and pageA / a are stored in the dynamic cache set (i.e., the web page cache set). At this time, if the user accesses pageA, then pageA is in the to-be-stored web page set corresponding to the page root path (pageA), and page caching is required. At this time, if the user enters the subpage pageA / a? Id=1, the subpage also exists in the to-be-stored web page set corresponding to the page root path (pageA), and page caching is required. However, since it is a detail page, the cache pages can be distinguished by the page access path "pageA / a" and the access link parameter "id=1". At this time, when multiple detail pages jump to each other, the page access path is "pageA / a", but the access link parameters are different, and the dynamic cache set needs to be updated;

[0145] If you enter page B at this time, it means that you have entered a page corresponding to a different page root path. At this time, the historical cache root path (pageA) is different from the page root path (pageB). It can be determined that a new set of mapping relationships has been entered. You can clear the previously cached pageA and its subset page cache (that is, clear the dynamic cache set), and then add pageB to the dynamic cache set.

[0146] If you enter another page pageC, the historical cache root path (pageA) is different from the page root path (pageC), and since pageC does not have a corresponding set of web pages to be stored in the inter-page cache mapping table, there is no need to cache it. Therefore, it can be determined that a page that does not need to be cached has been entered, and the dynamic cache collection can be cleared without adding new web pages to the dynamic cache collection.

[0147] In this embodiment, if the page access path exists in the to-be-stored web page set, the website page is stored in the web page cache set based on the page access path. Since when the website page is cached, a key-value pair is constructed with the page access path as the key and the website page as the value and stored in the web page cache set, it is ensured that when the cache needs to be used, it is possible to quickly detect whether there is a corresponding cache page based on the page access path, thereby improving the utilization efficiency of the cached page.

[0148] In addition, an embodiment of the present invention further provides a storage medium, on which a page cache program is stored. When the page cache program is executed by a processor, the steps of the page cache method described above are implemented.

[0149] Reference Figure 7 , Figure 7 It is a structural block diagram of the first embodiment of the page cache device of the present invention.

[0150] like Figure 7 As shown, the page cache device proposed in the embodiment of the present invention includes:

[0151] The data acquisition module 10 is used to acquire the page root path and page access path corresponding to the website page when detecting the access to the website page;

[0152] A data search module 20, used to search for a set of web pages to be stored corresponding to the page root path in a preset cache list;

[0153] The page cache module 30 is used to cache the website page if the page access path exists in the set of web pages to be stored.

[0154] This embodiment obtains the page root path and page access path corresponding to the website page when detecting the access to the website page; searches for the to-be-stored web page set corresponding to the page root path in the preset cache list; if the page access path exists in the to-be-stored web page set, the website page is cached. Since the page root path and page access path of the website page are obtained when caching the page, the website page is cached only when the page access path exists in the to-be-stored web page set corresponding to the page root path, so that it is not necessary to cache all web pages, but only cache some web pages that need to be cached, which reduces the space occupied by page caching, and due to the reduction of cached pages, the update of cached pages is also simpler, and there is no need to set too many monitoring methods, thereby improving the performance of page caching.

[0155] Furthermore, the data search module 20 is also used to obtain a historical cache root path; compare the historical cache root path with the page root path; if the historical cache root path is consistent with the page root path, search for a set of to-be-stored web pages corresponding to the page root path in a preset cache list.

[0156] Furthermore, the data search module 20 is also used to obtain a web page cache set if the historical cache root path is consistent with the page root path; detect whether there is a cache page corresponding to the page access path in the web page cache set; if not, search for a to-be-stored web page set corresponding to the page root path in a preset cache list.

[0157] Furthermore, the data search module 20 is also used to obtain the website access link corresponding to the website page; extract the access link parameter from the website access link; and detect whether there is a cache page corresponding to the page access path and the access link parameter in the web page cache set.

[0158] Furthermore, the data search module 20 is also used to generate a cache set index according to the page access path and the access link parameter; and detect whether there is a cache page corresponding to the cache set index in the web page cache set.

[0159] Furthermore, the data search module 20 is also used to extract the cache page from the web page cache set if it exists; and display the page according to the cache page.

[0160] Furthermore, the data search module 20 is also used to clear the web page cache set if the historical cache root path is inconsistent with the page root path; when the clearing is completed, search the preset cache list for the to-be-stored web page set corresponding to the page root path.

[0161] Furthermore, the page cache module 30 is further configured to store the website page in the web page cache set based on the page access path if the page access path exists in the set of web pages to be stored.

[0162] Furthermore, the page cache module 30 is also used to obtain the website access link corresponding to the website page if the page access path exists in the set of web pages to be stored; extract the access link parameters from the website access link; and store the website page in the web page cache set based on the page access path and the access link parameters.

[0163] Furthermore, the page cache module 30 is also used to combine the page access path and the access link parameters to generate a cache set index; construct a key-value pair based on the cache set index and the website page, and store the constructed key-value pair in the web page cache set.

[0164] Furthermore, the data acquisition module 10 is also used to monitor the address bar of the browser in real time; if it is monitored that the user enters a website access link in the address bar and confirms it, it is determined that the access to the website page is detected.

[0165] It should be understood that the above is only an example and does not constitute any limitation on the technical solution of the present invention. In specific applications, technicians in this field can make settings as needed, and the present invention does not limit this.

[0166] It should be noted that the workflow described above is merely illustrative and does not limit the scope of protection of the present invention. In practical applications, technicians in this field can select part or all of them according to actual needs to achieve the purpose of the present embodiment, and no limitation is made here.

[0167] In addition, for technical details that are not described in detail in this embodiment, reference can be made to the page caching method provided in any embodiment of the present invention, and will not be repeated here.

[0168] In addition, it should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or system. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or system including the element.

[0169] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.

[0170] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as a read-only memory (ROM) / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present invention.

[0171] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.

[0172] The present invention discloses A1, a page caching method, the page caching method comprising the following steps:

[0173] When detecting that a website page is accessed, obtaining the page root path and page access path corresponding to the website page;

[0174] Searching for a set of web pages to be stored corresponding to the page root path in a preset cache list;

[0175] If the page access path exists in the set of web pages to be stored, the website page is cached.

[0176] A2. In the page caching method described in A1, the step of searching the preset cache list for the set of web pages to be stored corresponding to the page root path comprises:

[0177] Get the history cache root path;

[0178] Compare the historical cache root path with the page root path;

[0179] If the historical cache root path is consistent with the page root path, the to-be-stored web page set corresponding to the page root path is searched in the preset cache list.

[0180] A3. The page caching method as described in A2, wherein if the historical cache root path is consistent with the page root path, the step of searching the preset cache list for a set of web pages to be stored corresponding to the page root path comprises:

[0181] If the historical cache root path is consistent with the page root path, obtaining a web page cache set;

[0182] Detecting whether there is a cache page corresponding to the page access path in the web page cache set;

[0183] If it does not exist, then search the preset cache list for the to-be-stored web page set corresponding to the page root path.

[0184] A4. The page caching method as described in A3, wherein the step of detecting whether there is a cache page corresponding to the page access path in the web page cache set comprises:

[0185] Obtaining a website access link corresponding to the website page;

[0186] Extracting access link parameters from the website access link;

[0187] It is detected whether there is a cache page corresponding to the page access path and the access link parameter in the web page cache set.

[0188] A5. The page caching method as described in A4, wherein the step of detecting whether the cached page corresponding to the page access path and the access link parameter exists in the web page cache set comprises:

[0189] Generate a cache set index according to the page access path and the access link parameters;

[0190] Detect whether there is a cache page corresponding to the cache set index in the web page cache set.

[0191] A6. The page caching method as described in A3, after the step of detecting whether there is a cache page corresponding to the page access path in the web page cache set, further comprising:

[0192] If so, extracting the cached page from the web page cache set;

[0193] The page is displayed according to the cached page.

[0194] A7. The page caching method as described in A2, after the step of comparing the historical page root path with the page root path, further comprising:

[0195] If the historical cache root path is inconsistent with the page root path, clear the web page cache set;

[0196] When the clearing is completed, the set of web pages to be stored corresponding to the page root path is searched in the preset cache list.

[0197] A8. The page caching method as described in A1, wherein if the page access path exists in the set of web pages to be stored, the step of caching the website page comprises:

[0198] If the page access path exists in the to-be-stored web page set, the website page is stored in the web page cache set based on the page access path.

[0199] A9. The page caching method as described in A8, wherein if the page access path exists in the set of web pages to be stored, the step of storing the website page in the web page cache set based on the page access path comprises:

[0200] If the page access path exists in the set of web pages to be stored, obtaining a website access link corresponding to the website page;

[0201] Extracting access link parameters from the website access link;

[0202] The website page is stored in a web page cache collection based on the page access path and the access link parameter.

[0203] A10. The page caching method as described in A9, wherein the step of storing the website page in a web page cache set based on the page access path and the access link parameter comprises:

[0204] Combining the page access path and the access link parameter to generate a cache set index;

[0205] A key-value pair is constructed according to the cache set index and the website page, and the constructed key-value pair is stored in the web page cache set.

[0206] A11. The page caching method as described in any one of A1 to A10, before the step of obtaining the page root path and page access path corresponding to the website page when detecting the access to the website page, further comprising:

[0207] Monitor the browser address bar in real time;

[0208] If it is monitored that the user enters a website access link in the address bar and confirms it, it is determined that the access to the website page is detected.

[0209] The present invention also discloses B12, a page cache device, the page cache device comprising the following modules:

[0210] A data acquisition module, used to acquire the page root path and page access path corresponding to the website page when detecting access to the website page;

[0211] A data search module, used to search for a set of web pages to be stored corresponding to the page root path in a preset cache list;

[0212] The page cache module is used to cache the website page if the page access path exists in the set of web pages to be stored.

[0213] B13. In the page cache device as described in B12, the data search module is also used to obtain a historical cache root path; compare the historical cache root path with the page root path; if the historical cache root path is consistent with the page root path, search the preset cache list for the set of web pages to be stored corresponding to the page root path.

[0214] B14. In the page cache device as described in B13, the data search module is also used to obtain a web page cache set if the historical cache root path is consistent with the page root path; detect whether there is a cache page corresponding to the page access path in the web page cache set; if not, search for the to-be-stored web page set corresponding to the page root path in a preset cache list.

[0215] B15. In the page cache device as described in B14, the data search module is also used to obtain the website access link corresponding to the website page; extract the access link parameter from the website access link; and detect whether there is a cache page corresponding to the page access path and the access link parameter in the web page cache collection.

[0216] B16. In the page cache device as described in B15, the data search module is further used to generate a cache set index according to the page access path and the access link parameters; and detect whether there is a cache page corresponding to the cache set index in the web page cache set.

[0217] B17. In the page cache device as described in B14, the data search module is further used to extract the cache page from the web page cache set if it exists; and display the page based on the cache page.

[0218] B18. In the page cache device as described in B13, the data search module is also used to clear the web page cache set if the historical cache root path is inconsistent with the page root path; when the clearing is completed, search the preset cache list for the to-be-stored web page set corresponding to the page root path.

[0219] The present invention also discloses C19, a page cache device, which includes: a processor, a memory, and a page cache program stored in the memory and executable on the processor, and the page cache program implements the steps of the page cache method described above when executed by the processor.

[0220] The present invention also discloses D20, a computer-readable storage medium, on which a page cache program is stored, and when the page cache program is executed, the steps of the page cache method described above are implemented.

Claims

1. A page caching method, characterized in that: The page caching method comprises the following steps: When detecting that a website page is accessed, obtaining the page root path and page access path corresponding to the website page; Searching for a set of web pages to be stored corresponding to the page root path in a preset cache list; If the page access path exists in the set of web pages to be stored, the website page is cached.

2. The page caching method according to claim 1, characterized in that: The step of searching the preset cache list for the set of web pages to be stored corresponding to the page root path includes: Get the history cache root path; Compare the historical cache root path with the page root path; If the historical cache root path is consistent with the page root path, the to-be-stored web page set corresponding to the page root path is searched in the preset cache list.

3. The page caching method according to claim 2, characterized in that: If the historical cache root path is consistent with the page root path, the step of searching the preset cache list for a set of web pages to be stored corresponding to the page root path includes: If the historical cache root path is consistent with the page root path, obtaining a web page cache set; Detecting whether there is a cache page corresponding to the page access path in the web page cache set; If it does not exist, then search the preset cache list for the to-be-stored web page set corresponding to the page root path.

4. The page caching method according to claim 3, characterized in that: The step of detecting whether there is a cache page corresponding to the page access path in the web page cache set includes: Obtaining a website access link corresponding to the website page; Extracting access link parameters from the website access link; It is detected whether there is a cache page corresponding to the page access path and the access link parameter in the web page cache set.

5. The page caching method according to claim 4, characterized in that: The step of detecting whether there is a cache page corresponding to the page access path and the access link parameter in the web page cache set includes: Generate a cache set index according to the page access path and the access link parameters; Detect whether there is a cache page corresponding to the cache set index in the web page cache set.

6. The page caching method according to claim 3, characterized in that: After the step of detecting whether there is a cache page corresponding to the page access path in the web page cache set, the method further includes: If so, extracting the cached page from the web page cache set; The page is displayed according to the cached page.

7. The page caching method according to claim 2, wherein: After the step of comparing the historical page root path with the page root path, the method further includes: If the historical cache root path is inconsistent with the page root path, clear the web page cache set; When the clearing is completed, the set of web pages to be stored corresponding to the page root path is searched in the preset cache list.

8. A page cache device, characterized in that: The page cache device includes the following modules: A data acquisition module, used to acquire the page root path and page access path corresponding to the website page when detecting access to the website page; A data search module, used to search for a set of web pages to be stored corresponding to the page root path in a preset cache list; The page cache module is used to cache the website page if the page access path exists in the set of web pages to be stored.

9. A page cache device, characterized in that: The page cache device comprises: a processor, a memory, and a page cache program stored in the memory and executable on the processor, wherein the page cache program implements the steps of the page cache method according to any one of claims 1 to 7 when executed by the processor.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a page cache program, and when the page cache program is executed, the steps of the page cache method according to any one of claims 1 to 7 are implemented.