CN116204398B - Page caching method, processing device and computer readable storage medium - Google Patents

Page caching method, processing device and computer readable storage medium Download PDF

Info

Publication number
CN116204398B
CN116204398B CN202310499323.9A CN202310499323A CN116204398B CN 116204398 B CN116204398 B CN 116204398B CN 202310499323 A CN202310499323 A CN 202310499323A CN 116204398 B CN116204398 B CN 116204398B
Authority
CN
China
Prior art keywords
page
application
information
open
stored
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202310499323.9A
Other languages
Chinese (zh)
Other versions
CN116204398A (en
Inventor
井友鼎
杜创胜
姬亮亮
朱彬
武鹏飞
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Hezhong Weiqi Technology Co ltd
Original Assignee
Beijing Hezhong Weiqi Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Hezhong Weiqi Technology Co ltd filed Critical Beijing Hezhong Weiqi Technology Co ltd
Priority to CN202310499323.9A priority Critical patent/CN116204398B/en
Publication of CN116204398A publication Critical patent/CN116204398A/en
Application granted granted Critical
Publication of CN116204398B publication Critical patent/CN116204398B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/34Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment
    • G06F11/3466Performance evaluation by tracing or monitoring
    • G06F11/3476Data logging
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3003Monitoring arrangements specially adapted to the computing system or computing system component being monitored
    • G06F11/302Monitoring arrangements specially adapted to the computing system or computing system component being monitored where the computing system component is a software system
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3051Monitoring arrangements for monitoring the configuration of the computing system or of the computing system component, e.g. monitoring the presence of processing resources, peripherals, I/O links, software programs
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/953Querying, e.g. by the use of web search engines
    • G06F16/9538Presentation of query results
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/957Browsing optimisation, e.g. caching or content distillation
    • G06F16/9574Browsing optimisation, e.g. caching or content distillation of access to content, e.g. by caching
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/448Execution paradigms, e.g. implementations of programming paradigms
    • G06F9/4482Procedural
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/451Execution arrangements for user interfaces
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Quality & Reliability (AREA)
  • Computing Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Mathematical Physics (AREA)
  • Computer Hardware Design (AREA)
  • Human Computer Interaction (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application discloses a page caching method, processing equipment and a computer readable storage medium, wherein the method comprises the following steps: receiving an opening instruction of a page of an application in response to the page of at least one historical application being in a cache state, wherein the opening instruction comprises information of the page; acquiring information of the application according to the information of the page; in response to determining that the application is not loaded according to the information of the application, loading the application according to the information of the application and acquiring an instance of the application; the instance of the application is stored so that it is stored concurrently with the instance of the at least one historical application to be cached after the page is opened. According to the scheme, a plurality of instances of different applications can be stored simultaneously, so that simultaneous caching of different application pages can be realized, and the problem that pages of multiple applications cannot be cached simultaneously in the prior art is solved.

Description

Page caching method, processing device and computer readable storage medium
Technical Field
The present application relates generally to the field of data storage technology. More particularly, the present application relates to a method, processing device and computer readable storage medium for page caching.
Background
The problems of low construction efficiency, overlarge maintenance cost, difficulty in multiplexing modules and the like in the development process of the B-end web application can be solved through the heaven and earth micro front-end technology. The application of the heaven and earth micro front-end technology can be divided into two types according to functions: a main application and a sub-application. The main application is generally responsible for providing general capabilities such as user login, storing and issuing user information, displaying application menus, loading sub-applications, etc., while the sub-applications only need to be responsible for displaying specific services, and no additional consideration is required for other service-independent implementations.
If the route configuration mode is adopted, when a user clicks a menu item in a menu, the universe monitors the url (uniform resource locator) change of the browser and activates a corresponding sub-application in a designated container of the main application, but the technology has no good solution for multi-application page cache.
Therefore, it is needed to provide a method, a processing device and a computer readable storage medium for page caching, where multiple instances of different applications in the solution can be stored simultaneously, so that simultaneous caching of different application pages can be achieved, and further the problem that pages of multiple applications cannot be cached simultaneously in the prior art is solved.
Disclosure of Invention
To address at least one or more of the technical problems mentioned above, the present application proposes a method, a processing device, and a computer-readable storage medium for page caching in various aspects.
In a first aspect, the present application provides a method for page caching, including: receiving an opening instruction of a page of an application in response to the page of at least one historical application being in a cache state, wherein the opening instruction comprises information of the page; acquiring information of the application according to the information of the page; in response to determining that the application is not loaded according to the information of the application, loading the application according to the information of the application and acquiring an instance of the application; and storing the instance of the application so that it is stored concurrently with the instance of the at least one historical application to cache the page after it is opened.
In one embodiment, after receiving an open instruction of a page of an application, the method further comprises: acquiring rendering data of the page according to the information of the page, a request of a user or a preset rule; and storing the rendering data of the page so as to cache the page after opening the page.
In one embodiment, the determining that the application is not loaded in response to the information from the application comprises: searching an information list of the loaded application according to the information of the application, wherein the information list of the loaded application comprises the information of the loaded application; and determining that the application is not loaded in response to not finding the information of the application.
In one embodiment, after loading the application, the method further comprises: storing the information of the page and the information of the application correspondingly, and deleting the stored information of the page when the page is closed; wherein after caching the page, the method further comprises: when a closing instruction of any cached open page is received, determining information of an application to which the open page belongs according to the information of the open page, the information of the corresponding stored page and the information of the application; and deleting the stored instance of the application to which the open page belongs in response to determining that other open pages corresponding to the application to which the open page belongs do not exist according to the information of the application to which the open page belongs, the information of the page and the information of the application which are correspondingly stored.
In one embodiment, the application comprises a web application and the information of the page comprises routing information of the page; wherein after caching the page, the method further comprises: receiving a cached switching instruction of an open page, wherein the switching instruction comprises an access address for accessing the open page; accessing the stored route information of each page, and respectively matching the route information of each page with the access address; and determining an open page to be switched according to the matching result so as to display the open page.
In one embodiment, the application comprises a sub-application of a system, the system further comprising a main application that event listens to the sub-application, and receiving the cached switch instruction to open the page comprises: when a master application monitors a switching event of the open page issued by a sub-application, determining that a switching instruction of the open page is received, wherein the master application monitors events of the sub-application through an event monitoring instance which is sent to the sub-application in advance by the master application, and the switching event of the open page comprises an access address for accessing the open page.
In one embodiment, the applications include sub-applications of a system, the system further comprising a main application for storing information of the page in a memory module thereof; wherein accessing the stored routing information for each page includes: receiving an access request of routing information of each page stored in a storage module of a main application, wherein the storage module of the main application is issued to a sub-application in advance by the main application; and accessing the routing information of each page according to the access request.
In one embodiment, the application is a web application and the information of the page includes routing information of the page; after obtaining the information of the application according to the information of the page, the method further comprises the following steps: searching an access authority list of a user according to the information of the application to judge whether the user has the access authority of the application, wherein the access authority list is a pre-acquired authority list related to the user executing the method, and at least comprises the information of the application with the access authority of the user; and determining whether to open the page according to the routing information of the page according to the judging result.
In one embodiment, the access authority list further includes routing information of a page stored corresponding to the information of the application, and determining whether to open the page according to the routing information of the page according to the determination result includes: responding to the judging result that the user has the access right of the application, and searching the access right list according to the information of the application and the routing information of the page to judge whether the user has the access right of the page; and determining whether to open the page according to the routing information of the page according to the judging result.
In a second aspect, the present application also provides a processing apparatus comprising: a processor configured to execute program instructions; and a memory configured to store the program instructions, which when loaded and executed by the processor, cause the processor to perform the method of page caching according to any embodiment of the first aspect.
In a third aspect, the present application also provides a computer readable storage medium having stored therein program instructions which, when loaded and executed by a processor, cause the processor to perform a method of page caching according to any one of the embodiments of the first aspect.
Through the method, the processing equipment and the computer readable storage medium for caching the page, which are provided by the application, a plurality of instances of different applications can be stored simultaneously, so that the simultaneous caching of different application pages can be realized, and the problem that pages of multiple applications cannot be cached simultaneously in the prior art is solved.
Drawings
The above, as well as additional purposes, features, and advantages of exemplary embodiments of the present application will become readily apparent from the following detailed description when read in conjunction with the accompanying drawings. In the drawings, embodiments of the application are illustrated by way of example and not by way of limitation, and like reference numerals refer to similar or corresponding parts and in which:
FIG. 1 shows a schematic flow chart of a method of page caching according to an embodiment of the application;
FIG. 2 shows a schematic flow chart of a method of page caching according to another embodiment of the application;
FIG. 3 shows a schematic flow chart of a cached open page switching method according to an embodiment of the application;
FIG. 4 shows a schematic flow chart diagram of a method of page permission control according to an embodiment of the application;
fig. 5 is a block diagram of a processing apparatus according to an embodiment of the present application.
Detailed Description
The following description of the embodiments of the present application will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are some, but not all embodiments of the application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
It should be understood that the terms "comprises" and "comprising," when used in this specification and in the claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It is also to be understood that the terminology used in the description of the application herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. As used in the specification and claims, the singular forms "a", "an" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should be further understood that the term "and/or" as used in the present specification and claims refers to any and all possible combinations of one or more of the associated listed items, and includes such combinations.
As used in this specification and the claims, the term "if" may be interpreted as "when..once" or "in response to a determination" or "in response to detection" depending on the context. Similarly, the phrase "if a determination" or "if a [ described condition or event ] is detected" may be interpreted in the context of meaning "upon determination" or "in response to determination" or "upon detection of a [ described condition or event ]" or "in response to detection of a [ described condition or event ]".
Specific embodiments of the present application are described in detail below with reference to the accompanying drawings.
FIG. 1 shows a schematic flow diagram of a method 100 of page caching according to an embodiment of the application.
As shown in fig. 1, the method 100 may include, at step S101, receiving an open instruction of a page of an application in response to at least one page of a history application being in a cached state, wherein the open instruction includes information of the page. The information of the page may include an identification of the page (page ID) and/or a name of the page, etc.
The method 100 may be performed at a terminal. In the heaven and earth micro front-end system, the historical application and the application to be cached currently can comprise sub-applications of the system. It will be appreciated that the application needs to be loaded and its instance acquired and stored when its page is first cached. Thus, at the time of page caching of a history application, it is explained that the history application has been loaded, and its instance has been fetched and stored.
Next, the method 100 may proceed to step S102, where information of the application is obtained according to the information of the page. In this embodiment, the information of the application may include one or more of an identification of the application, a name, routing information of the application, and the like. In one implementation, information for an application may be obtained from routing information for a page.
Next, the method 100 may proceed to step S103, in response to determining that the application is not loaded according to the above-described information of the application, loading the application according to the information of the application and obtaining an instance of the application.
In one implementation scenario, the information of the loaded application may be stored in an information list, so that the information list may be searched according to the information of the application; determining that the application is not loaded in response to not finding the information of the application; accordingly, in response to finding the information of the application, the application is declared loaded. In the heaven and earth micro front-end system, the information list can be stored in an openmicro apps array of a common module of the system main application. Here, the application may be loaded according to routing information of the application, or the like. In the heaven and earth micro front-end system, applications may be installed in div containers created after a user accesses the system. In addition, the instance of the application may be acquired from the server by the terminal, and may be stored in the above-described information list in correspondence with the information of the application, so as to perform operations such as corresponding search.
At present, in a heaven and earth micro front-end system, when a page of a certain application is in a cache state, when pages of other applications are cached, an instance of the cached application is automatically replaced, so that only an instance of the current application is stored, and therefore the system cannot realize the caching of multiple application pages. To solve this problem, in this embodiment, the method 100 may then proceed to step S104 to store the instance of the application so as to be stored simultaneously with the instance of the at least one historical application, so as to cache the page after opening it.
In response to determining that the application has been loaded, it is stated that the instance of the application has been acquired and stored at this time (the instance was acquired and stored when the application was first loaded), without the need to acquire it again.
In this embodiment, since multiple instances of different applications may be stored simultaneously, simultaneous caching of different application pages may be implemented, thereby solving the problem in the prior art that pages of multiple applications cannot be cached simultaneously.
In one embodiment, after receiving an opening instruction of a page of the application, the method may further include obtaining rendering data of the page according to information of the page, a request of a user, or a preset rule, and storing the rendering data of the page so as to buffer the page after opening the page. In one implementation, the rendering data for the page may be related to the information of the page and stored in a memory area of the terminal, so that it may be acquired from the information of the page. In another implementation, the rendering data for the page may also be stored in a database of the server for retrieval upon a user's associated request. In still another implementation, a default interface corresponding to a page to be opened may be preset, so that after receiving an opening instruction of the page, the terminal invokes the default interface, and thus, rendering data of the corresponding page is obtained from the default interface.
FIG. 2 shows a schematic flow diagram of a method 200 of page caching according to another embodiment of the application.
As shown in the figure, the method 200 may include receiving an open instruction of a page of an application in response to at least one page of a history application being in a cached state, wherein the open instruction includes information of the page at step S201. At step S202, the method 200 may acquire information of an application from information of a page. At step S203, the method 200 may load an application and obtain an instance of the application according to the information of the application in response to determining that the application is not loaded according to the information of the application. At step S204, the method 200 may store the instance of the application concurrently with the instance of the at least one historical application to cache the page after it is opened.
The steps S201, S202, S203 and S204 may be the same as the steps S101, S102, S103 and S104, and will not be described in detail herein. After step S203, in response to determining that the application has been loaded, only the rendering data of the page need be acquired and stored in the above-described manner, so that the page display is performed subsequently.
In this embodiment, in order to facilitate operations such as corresponding search, the information of the page and the information of the application to which the page belongs may be stored in the same storage location, for example, in the above-mentioned information list.
In order to perform related operations according to different states of opening and closing of the page, after loading the application, the method 200 may include storing information of the page and information of the application in correspondence and deleting the stored information of the page when closing the page at step S205. Based on this, after caching the page, the method 200 may further include, at step S206, when receiving a close instruction for any cached open page, determining information of an application to which the open page belongs according to the information of the open page and the information of the corresponding stored page and the information of the application.
Here, the application to which the page belongs may be determined by looking up the above information list according to the information of the opened page. For example, the application a and the corresponding pages a1, a2, and a3 are correspondingly stored in the information list. For opening the page a1, the information list may be searched according to the page a1, and it is determined that the application to which the page belongs is the application a.
Next, at step S207, in response to determining that there are no other open pages corresponding to the application to which the open page belongs according to the information of the application to which the open page belongs and the information of the page and the information of the application stored correspondingly, the method 200 may delete the stored instance of the application to which the open page belongs, so that the subsequent caching operation of the page may be facilitated.
For example, with the above embodiment, when it is determined that the application to which the open page a1 belongs is the application a, it may be determined that the application a also exists with the open pages a2 and a3 by looking up the information list at this time.
If the information list has no page corresponding to the application A, the page which is not opened by the application A is indicated, and the stored instance of the application A can be deleted at the moment so as to continue the caching operation subsequently. In the heaven and earth micro front-end system, an unmount method of the sub-application instance can be called to destroy the sub-application instance. At this time, the information of the loaded application included in the information list may be deleted for the subsequent caching operation.
And in response to the existence of other open pages, not deleting the stored instance of the application to which the open page belongs, and continuing to execute corresponding operations.
Repeated execution of the caching operation can be ensured by the method 200 of the present embodiment.
The application may be a web application, the information of the page may include routing information of the page, in an embodiment, the switched open page may be determined according to the routing information of the page and an access address input by a user, and a method for switching the cached open page will be described in detail with reference to fig. 3. FIG. 3 shows a schematic flow chart of a cached open page switching method 300 according to an embodiment of the application.
As shown in the figure, after caching the page, the switching method 300 may include receiving a cached switching instruction of an open page, where the switching instruction includes an access address for accessing the open page, at step S301.
From the foregoing description, in the universe micro front-end system, the application may include a sub-application of the system, and the system further includes a main application for performing event monitoring on the sub-application. And when the main application monitors a switching event of the opened page issued by the sub-application, determining that a switching instruction of the opened page is received. In the heaven and earth micro front-end system, the main application can perform event monitoring through an event monitoring instance (such as a eventBus instance in the heaven and earth micro front-end system) which is sent to the sub-application in advance, and an access address for accessing the opened page can be included in the switching event of the opened page.
After receiving the switching instruction for opening the page, the opening method 300 may proceed to step S302, where the stored routing information of each page may be accessed, and the routing information of each page may be respectively matched with the access address. The matching here may be to compare the routing field of the page in the access address with the routing information of the respective page.
Where the application comprises a sub-application of the system, the system may further comprise a main application for storing information of the page in its storage module (e.g. a common module in a universe micro-front-end system). At this time, the stored route information of each page may be accessed by: the terminal may receive an access request for routing information of each page stored in a memory module of the host application. The storage module of the main application may be issued to each sub-application in advance for the main application, and the sub-application may register it locally. In the heaven and earth micro front-end system, the sub-application can register the common module to its own state management library.
Then, the routing information of each page can be accessed according to the above access request.
Based on this, at step S303, the switching method 300 may determine an open page to be switched according to the matching result to display it. Specifically, when the access address matches the routing information of the page, it may be determined that the page is a page to be switched. By the method, the page can be accurately switched.
In order to ensure the security of the information, in some implementation scenarios, the page access rights of the user may be set. FIG. 4 shows a schematic flow chart diagram of a method 400 of page permission control in accordance with an embodiment of the application.
The application may be a web application and the information of the page may include routing information of the page.
As described in fig. 4, after acquiring information of an application according to information of a page, the method 400 may include searching an access authority list of a user according to information of the application to determine whether the user has access authority of the application, wherein the access authority list is a pre-acquired authority list of the user performing the method of the present application, and wherein at least the information of the application to which the user has access authority is included at step S401. The access authority list may be obtained from a server according to user information obtained when the user logs in the system, and the user information may include a name and/or identity information of the user.
In the heaven and earth micro front-end system, the user's access rights list may be stored in the common module of the host application and in the local storage area of the browser.
Next, the method 400 may determine whether to open the page according to the routing information of the page according to the determination result at step S402.
When the user is determined to not have the access right of the application, the user can be determined not to open the page and carry out corresponding prompt; and when the user has the access right of the application, continuing to judge whether to open the page according to the routing information of the page. The possibility of whether the user has the access right of the page can be determined by determining whether the user has the access right of the application or not, so that the user does not need to further judge whether the user has the access right of the page of the application or not when the user does not have the access right of the application, thereby simplifying the flow and improving the efficiency.
In order to further determine whether to open the page, after determining that the user has the access right of the application, the method can further continuously determine whether the user has the access right of the page corresponding to the application, so as to determine whether to open the page. At this time, the access authority list may further include routing information of a page stored in correspondence with the information of the application. Determining whether to open the page according to the routing information of the page according to the judging result at this time may include:
and responding to the judging result that the user has the access right of the application, and searching an access right list according to the information of the application and the routing information of the page so as to judge whether the user has the access right of the page.
Assuming that an application with access rights of a user is an application a, the route information of the pages stored corresponding to the application a is URL1, URL2 and URL3, that is, the user has access rights of the pages corresponding to the route information of the pages. At this time, if the routing information of the page to be opened is URL1, the user is confirmed to have the access right of the page; if the routing information of the page to be opened is URL4, the user is confirmed not to have the access right of the page.
Then, whether to open the page according to the routing information of the page may be determined according to the determination result. When the user is determined to have the access right of the page, the page is determined to be opened according to the routing information of the page. For example, if the user has access rights to the page corresponding to the routing information URL1 of the page, the page may be opened according to URL 1. When the user is determined not to have the access right of the page, the page is determined not to be opened. For example, if the user does not have access rights to the page corresponding to the routing information URL3 of the page, it is determined that the page is not opened. By the scheme, only the page with the access right of the user can be opened, so that the safety of information can be protected.
In order to fully explain the scheme of the application, such as the page cache, will be described in detail by taking the heaven and earth micro front-end system as an example.
The scheme can perform operations such as caching, page display and the like of a plurality of sub-application pages through the following method.
And A1, when a user logs in a system page, an account number password is input, an access request is initiated, and an interface provided by a server is called according to the access request to acquire sub-application data and corresponding menu data. The acquired server data are subjected to format conversion, and the data after format conversion are respectively stored in a common module (public module) of vuex and a sessionStorage (local storage area) of a browser, so that the data can be prevented from being lost when the data are stored in the local storage area of the browser.
And A2, rendering the menu on an index. Vue page by using the sub-application data after format conversion and the corresponding menu data, and dynamically creating a plurality of div (content dividing element) containers for mounting according to the number of sub-applications in the system. In this embodiment, a menu corresponding to an application in a preset order in the information list (for example, the first one above in the information list) is displayed at this time.
And step A3, when the user clicks a menu item in the menu to open the page of the sub-application (the opening instruction can comprise information of the page, and the information of the page can comprise one or more of page identification, page name and page URL), the information of the sub-application can be acquired according to the information of the page. In addition, the rendering data of the page can be obtained according to the information of the page, the request of the user or a preset rule.
Next, a new tab may be added, for example, an addCurrentTab method is called, and whether the information of the sub-application is included in an openmicro apps array (in which the information of the loaded sub-application is stored in the form of an information list) in the common module state is first judged according to the information of the sub-application, so as to determine whether the sub-application has been loaded.
When the sub-application is loaded, the menu data (menu identification and/or menu name, etc.) corresponding to the sub-application and the page information are added into an information list in the openMicroApps array, and rendering data of the page can be stored.
If the sub-application is not loaded, the sub-application is manually loaded, specifically, the sub-application is rendered into a corresponding div container, an instance of the sub-application is obtained for subsequent use, and rendering data of the instance and the page are stored in an openMicroApps array.
Step A4, the sub-application can determine the open page and the page number of each loaded sub-application according to the information of the page in the maintained information list in the openMicroApps array, and then loop keep-alive (built-in component, which has the function of caching the removed component instance when dynamically switching among a plurality of components, for example, caching the open page which is not currently displayed when switching among a plurality of pages) and wrapping router-view labels. When switching cached open pages, the switch instruction may include an access address (e.g., a URL input to a browser) for accessing the open page. In the process of cycling keep-alive, judging whether the route information of the page in the current cycle is consistent with the URL of the current browser. If so, the router-view container is used to display the page corresponding to the route information of the page, so as to switch to the corresponding page, specifically, by the v-if (vue built-in instruction for conditionally rendering a piece of content) it can be judged which router-view container is displayed to realize the caching of the page.
And A5, clicking to close 1 open page after the page is opened, deleting the information of the page from the openMicroApps array when the page is closed, and then judging whether other open pages exist in the sub-application to which the closed page belongs. If the page belonging to the sub-application is not in an active state (in an open state) currently, invoking an un method of the sub-application instance to destroy the instance of the sub-application, and deleting the information of the sub-application from the openMicroApps array.
When the menu item of the menu is clicked again, the step A3 is repeated, so that a plurality of sub-application instances can be stored simultaneously, and further, the caching of a plurality of sub-application pages is realized.
The above describes the caching of multiple sub-application pages. The following schemes describe various communication modes between applications in the Qiankun micro front-end system. And B1, the main application calls an initGlobal State (initialization global state) method in action. Js, initializes and exports the Global State instance when the webpage is opened, namely, executes the method in action. Js when the webpage is opened, and initializes and exports the Global State instance. Invoking the new Vue (create Vue instance) method initializes and exports the eventBus instance. The above two instance on event listening is imported in the monitored lifecycle of the master application index.
And B2, when the main application invokes a method for manually loading or automatically loading the sub-application, the common module of the main application and the GlobalState instance and the eventBus instance created in the step B1 are transmitted to the sub-application.
And B3, binding the two instances transferred in the step B2 to the prototype object of the sub application vue in the mount life cycle to realize global calling, and acquiring a common module issued by the main application so that the common module is registered in the vuex as a part of the vuex of the sub application to realize sharing data and communication of multiple applications. The specific communication modes comprise: the specific modified data (data designated at the initialization of the main application) is listened to by onglobalstateChange (listening to the specific modified data by the global state listener) when the application operates globalState to make a corresponding operation. When the event is issued by the application operation eventBus instance, the corresponding operation is made to the corresponding monitored event through the corresponding setting (namely, when the event is issued by the application operation eventBus instance, the set corresponding event monitoring is triggered, and different response operations are made according to different events and transmitted parameters). When a common module in the application operation vuex changes state in a certain method, such as commit, data in the common module of the main application also changes, and all sub-applications using the data can synchronously change page rendering according to the change of the data. The communication methods can enable the heaven and earth micro front-end system to have a more perfect communication mode, and solve the problem that the communication mode of the initGlobal State application provided by the conventional heaven and earth micro front-end technology is not perfect.
The related operation in the page cache can be realized through the communication mode of event monitoring, for example, in the switching event of receiving the cached open page, the switching instruction of the open page can be received through the issuing of the common module of the main application.
In addition, in order to protect the safety of information, the scheme also provides a permission control strategy of the page and a permission control strategy of the button, so that illegal operations (such as permission control of the page which is not authorized to be accessed) of a user can be controlled.
In the aspect of page authority control, before loading a sub-application or rendering a sub-application page, that is, clicking a menu to open the page or modifying a browser url (inputting a new access address), the method comprises the following steps of: and B1, acquiring an access authority list of the user from the global communication method of the binding registration in the step B1, wherein the access authority list is a pre-acquired authority list related to the user executing the method of the application, and at least comprises information of sub-applications of which the user has access authority and routing information of corresponding pages. It will be appreciated that the access rights list may be obtained from a server based on user information obtained when a user logs into the system.
Further, the method of the present application can search the permission list according to the information of the sub-application to determine whether the user has the access permission of the page (the specific method can determine whether the user has the access permission of the sub-application as described above, and determine whether the user has the access permission of the page when the user has the access permission of the sub-application). If the access right exists, the page can be opened according to the routing information of the page, otherwise, the page can be jumped to a corresponding page, for example, a 404 page, so that the user cannot open the page. By the permission control, the user can be prevented from illegally accessing the page, so that the information security is ensured.
When the user clicks the button, the sub-application acquires the button data (including the identification and/or name of the button) of the button in the mount lifecycle, and stores the button data and the user information (which can be acquired when the user logs in the system) in its own storage area.
A getOperationStatus method (determine whether to use in the operation authority method) is defined, which can search a button authority list (which may include button information that the user has operation authority) based on button data to determine whether the user has operation authority of the button. Then, the control of the button authority can be realized by binding v-if to the button after the call in the computer, that is, when the user is determined to have the operation authority of the button, the button can be correspondingly operated, otherwise, the button is not displayed, so that the corresponding operation is prevented from being executed. The corresponding operation can be prevented from being illegally overridden by the user through the authority control, so that the safety of information is ensured.
Fig. 5 is a block diagram of a processing device 500 according to an embodiment of the application.
As shown in fig. 5, the device 500 of the present application may include a processor 501 and a memory 502, wherein the processor 501 and the memory 502 communicate via a bus 503. The memory 502 stores program instructions executable by the processor 501 which, when executed by the processor 501, cause the apparatus to perform the method steps described hereinbefore in connection with the accompanying figures.
According to the description of the embodiments of the method part related to page caching, the application can realize simultaneous caching of different application pages because a plurality of different application instances can be stored simultaneously, thereby solving the problem that pages of multiple applications cannot be cached simultaneously in the prior art.
Those of ordinary skill in the art will appreciate that: all or part of the steps of implementing the above method embodiments may be implemented by hardware associated with program instructions, and the foregoing program may be stored in a computer readable storage medium, which when executed, performs steps including the above method embodiments.
From the above description of the embodiments, it will be apparent to those skilled in the art that the embodiments may be implemented by means of software plus necessary general hardware platforms, or of course may be implemented by means of hardware. Based on this understanding, the foregoing technical solution may be embodied essentially or in a part contributing to the prior art in the form of a software product, which may be stored in a computer readable storage medium, such as ROM/RAM, a magnetic disk, an optical disk, etc., including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method described in the respective embodiments or some parts of the embodiments.
It should be understood that the terms "first," "second," "third," and "fourth," etc. in the claims, specification and drawings of the present application are used for distinguishing between different objects and not for describing a particular sequential order. The terms "comprises" and "comprising" when used in the specification and claims of the present application are taken to specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
While various embodiments of the present application have been shown and described herein, it will be obvious to those skilled in the art that such embodiments are provided by way of example only. Numerous modifications, changes, and substitutions will occur to those skilled in the art without departing from the spirit and scope of the application. It should be understood that various alternatives to the embodiments of the application described herein may be employed in practicing the application. The appended claims are intended to define the scope of the application and are therefore to cover all equivalents or alternatives falling within the scope of these claims.

Claims (9)

1. A method for caching pages, comprising:
receiving an opening instruction of a page of an application in response to the page with at least one historical application being in a cache state, wherein the opening instruction comprises information of the page, the application is a web application, the information of the page comprises routing information of the page, the application comprises a sub-application of a system, and the system further comprises a main application; acquiring information of the application according to the information of the page;
in response to determining that the application is not loaded according to the information of the application, loading the application according to the information of the application and acquiring an instance of the application; and
storing the instance of the application in a storage module of the host application so that it is stored concurrently with the instance of the at least one historical application for caching after opening the page;
wherein, after the information of the application is obtained according to the information of the page, the method further comprises:
searching an access authority list of a user according to the information of the application to judge whether the user has the access authority of the application, wherein the access authority list is a pre-acquired authority list related to the user executing the method, and at least comprises the information of the application with the access authority of the user; and
and determining whether to open the page according to the routing information of the page according to the judging result.
2. The method of claim 1, wherein after receiving an open instruction for a page of an application, the method further comprises:
acquiring rendering data of the page according to the information of the page, a request of a user or a preset rule; and
the rendering data of the page is stored for caching after opening the page.
3. The method of claim 1, wherein after loading the application, the method further comprises:
storing the information of the page and the information of the application correspondingly, and deleting the stored information of the page when the page is closed;
wherein after caching the page, the method further comprises:
when a closing instruction of any cached open page is received, determining information of an application to which the open page belongs according to the information of the open page, the information of the corresponding stored page and the information of the application;
and deleting the stored instance of the application to which the open page belongs in response to determining that other open pages corresponding to the application to which the open page belongs do not exist according to the information of the application to which the open page belongs, the information of the page and the information of the application which are correspondingly stored.
4. The method of claim 3, wherein after caching the page, the method further comprises:
receiving a cached switching instruction of an open page, wherein the switching instruction comprises an access address for accessing the open page;
accessing the stored route information of each page, and respectively matching the route information of each page with the access address; and
and determining an open page to be switched according to the matching result so as to display the open page.
5. The method of claim 4, wherein the master application is configured to event snoop the child applications, and receiving the cached switch instruction to open the page comprises:
when the main application monitors the switching event of the open page issued by the sub application, determining that a switching instruction of the open page is received,
the master application monitors events of the sub-applications through event monitoring instances which are sent to the sub-applications in advance, and the switching event of the open page comprises an access address for accessing the open page.
6. The method of claim 4, wherein the host application is configured to store information of the page in a memory module thereof; wherein accessing the stored routing information for each page includes:
receiving an access request of routing information of each page stored in a storage module of a main application, wherein the storage module of the main application is issued to a sub-application in advance by the main application; and
and accessing the routing information of each page according to the access request.
7. The method of claim 1, wherein the access authority list further includes routing information of a page stored corresponding to information of an application, and determining whether to open the page according to the routing information of the page according to the determination result comprises:
responding to the judging result that the user has the access right of the application, and searching the access right list according to the information of the application and the routing information of the page to judge whether the user has the access right of the page; and
and determining whether to open the page according to the routing information of the page according to the judging result.
8. A processing apparatus, comprising:
a processor configured to execute program instructions; and
a memory configured to store the program instructions, which when loaded and executed by the processor, cause the processor to perform the method of page caching according to any one of claims 1 to 7.
9. A computer readable storage medium, in which program instructions are stored which, when loaded and executed by a processor, cause the processor to perform the method of page caching according to any one of claims 1 to 7.
CN202310499323.9A 2023-05-06 2023-05-06 Page caching method, processing device and computer readable storage medium Active CN116204398B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310499323.9A CN116204398B (en) 2023-05-06 2023-05-06 Page caching method, processing device and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310499323.9A CN116204398B (en) 2023-05-06 2023-05-06 Page caching method, processing device and computer readable storage medium

Publications (2)

Publication Number Publication Date
CN116204398A CN116204398A (en) 2023-06-02
CN116204398B true CN116204398B (en) 2023-08-18

Family

ID=86509880

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310499323.9A Active CN116204398B (en) 2023-05-06 2023-05-06 Page caching method, processing device and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN116204398B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106294648A (en) * 2016-08-03 2017-01-04 腾讯科技(深圳)有限公司 A kind of processing method and processing device for page access path
CN113961298A (en) * 2021-11-17 2022-01-21 中国建设银行股份有限公司 Page switching method, device, equipment and medium
CN114579904A (en) * 2022-03-01 2022-06-03 浪潮云信息技术股份公司 Page cache implementation method based on anchor route distribution type micro front end
CN115080164A (en) * 2022-06-17 2022-09-20 北京快乐茄信息技术有限公司 Micro front-end page jump method, device and storage medium
CN115185708A (en) * 2022-06-17 2022-10-14 北京快乐茄信息技术有限公司 Communication method, communication device, terminal equipment and storage medium of micro front end
CN115758010A (en) * 2022-12-08 2023-03-07 荃豆数字科技有限公司 Page display method and device of sub-application and storage medium

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11080354B2 (en) * 2019-08-29 2021-08-03 Capital One Services, Llc Systems and methods for presenting web application content

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106294648A (en) * 2016-08-03 2017-01-04 腾讯科技(深圳)有限公司 A kind of processing method and processing device for page access path
CN113961298A (en) * 2021-11-17 2022-01-21 中国建设银行股份有限公司 Page switching method, device, equipment and medium
CN114579904A (en) * 2022-03-01 2022-06-03 浪潮云信息技术股份公司 Page cache implementation method based on anchor route distribution type micro front end
CN115080164A (en) * 2022-06-17 2022-09-20 北京快乐茄信息技术有限公司 Micro front-end page jump method, device and storage medium
CN115185708A (en) * 2022-06-17 2022-10-14 北京快乐茄信息技术有限公司 Communication method, communication device, terminal equipment and storage medium of micro front end
CN115758010A (en) * 2022-12-08 2023-03-07 荃豆数字科技有限公司 Page display method and device of sub-application and storage medium

Also Published As

Publication number Publication date
CN116204398A (en) 2023-06-02

Similar Documents

Publication Publication Date Title
US9742789B2 (en) Method, device and system for intercepting web address
US9418243B2 (en) Invoking a private browsing mode by selection of a visual control element within a browser tab
US9832210B2 (en) Multi-core browser and method for intercepting malicious network address in multi-core browser
US9697353B2 (en) Method and device for intercepting call for service by application
CN109446457A (en) Update method, terminal device and the medium of page data
US20170372180A1 (en) Smart card read/write method and apparatus
CN105427096A (en) Payment security sandbox realization method and system and application program monitoring method and system
US20140007117A1 (en) Methods and apparatus for modifying software applications
CN104881601A (en) Floating window display setup, control method and device
CN103826215A (en) Method and apparatus for carrying out root authority management at terminal equipment
CN104516885A (en) Implementation method and device of browse program double-kernel assembly
CN104036019A (en) Method and device for opening webpage links
CN109831351B (en) Link tracking method, device, terminal and storage medium
CN106911782A (en) A kind of method for reading data and device
CN108763951A (en) A kind of guard method of data and device
CN109325192B (en) Advertisement anti-shielding method and device
CN111177727A (en) Vulnerability detection method and device
CN108289080B (en) Method, device and system for accessing file system
US9164817B2 (en) Mobile communication terminal to provide widget expansion function using message communication, and operation method of the mobile communication terminal
CN109639884A (en) A kind of method, storage medium and terminal device based on Android monitoring sensitive permission
CN116204398B (en) Page caching method, processing device and computer readable storage medium
CN110362305B (en) Form component state switching method and device
CN112988353B (en) Application program running control method and device
CN106060124A (en) Application program downloading method and mobile terminal
CN109165509A (en) The software method of credible measurement, equipment, system and storage medium in real time

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant